Table of Contents

Enum PngCompressionStrategy

Namespace
Egami.Formats.Png
Assembly
Egami.dll

The Deflate strategy for the image data.

public enum PngCompressionStrategy

Fields

Auto = 0

The 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 = 2

Tuned for filtered data: favors Huffman coding over string matching.

HuffmanOnly = 3

Huffman coding only, no string matching. Fast.

RunLengthEncoding = 4

Only matches of the previous byte. Good for images with long runs.

Standard = 1

zlib'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,
});