Enum PngCompressionStrategy
The Deflate strategy for the image data.
public enum PngCompressionStrategy
Fields
Auto = 0The strategy Egami picks. Currently Standard: in Egami's benchmarks with the runtime's zlib, Filtered was never smaller and was larger at level 9.
Filtered = 2Tuned for filtered data: favors Huffman coding over string matching.
HuffmanOnly = 3Huffman coding only, no string matching. Fast.
RunLengthEncoding = 4Only matches of the previous byte. Good for images with long runs.
Standard = 1zlib's default strategy.
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,
});