diff --git a/src/ImageSharp/Formats/Png/PngEncoderOptions.cs b/src/ImageSharp/Formats/Png/PngEncoderOptions.cs
index 3c17c24636..0bcea037ab 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderOptions.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderOptions.cs
@@ -18,11 +18,7 @@ namespace SixLabors.ImageSharp.Formats.Png
{
this.BitDepth = source.BitDepth;
this.ColorType = source.ColorType;
-
- // Specification recommends default filter method None for paletted images and Paeth for others.
- this.FilterMethod = source.FilterMethod ?? (source.ColorType == PngColorType.Palette
- ? PngFilterMethod.None
- : PngFilterMethod.Paeth);
+ this.FilterMethod = source.FilterMethod;
this.CompressionLevel = source.CompressionLevel;
this.TextCompressionThreshold = source.TextCompressionThreshold;
this.Gamma = source.Gamma;
@@ -41,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Png
public PngColorType? ColorType { get; set; }
///
- public PngFilterMethod? FilterMethod { get; }
+ public PngFilterMethod? FilterMethod { get; set; }
///
public PngCompressionLevel CompressionLevel { get; } = PngCompressionLevel.DefaultCompression;
diff --git a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
index 23ca869936..1250db6fe0 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
@@ -34,6 +34,18 @@ namespace SixLabors.ImageSharp.Formats.Png
// a sensible default based upon the pixel format.
options.ColorType ??= pngMetadata.ColorType ?? SuggestColorType();
options.BitDepth ??= pngMetadata.BitDepth ?? SuggestBitDepth();
+ if (!options.FilterMethod.HasValue)
+ {
+ // Specification recommends default filter method None for paletted images and Paeth for others.
+ if (options.ColorType == PngColorType.Palette)
+ {
+ options.FilterMethod = PngFilterMethod.None;
+ }
+ else
+ {
+ options.FilterMethod = PngFilterMethod.Paeth;
+ }
+ }
// Ensure bit depth and color type are a supported combination.
// Bit8 is the only bit depth supported by all color types.