Enum PngFilterMode
How the PNG writer filters scanlines before compression (PNG specification, section 12.7).
public enum PngFilterMode
Fields
Adaptive = 0For each row, try all five filters and keep the one with the smallest sum of absolute values, as the specification recommends. Palette images and bit depths below 8 use no filter.
Average = 4Difference from the average of left and above.
None = 1No filter.
Paeth = 5Difference from the Paeth predictor of left, above and upper-left.
Sub = 2Difference from the pixel to the left.
Up = 3Difference from the pixel above.
Examples
// Force a palette, choose a filter and a zlib strategy, and keep a private chunk.
((PngDetails)image.Metadata.FormatDetails!).OtherChunks.Add(
new PngChunk("prVt", "hello"u8.ToArray(), PngChunkPosition.AfterImageData));
image.Save("duck-palette.png", new PngWriterOptions
{
ColorType = PngColorType.Palette,
Filter = PngFilterMode.Paeth,
CompressionStrategy = PngCompressionStrategy.Filtered,
});