PeachImage
PeachImage.Formats.Png
PngEncoderOptions Class
PNG-specific encode options.
public sealed class PngEncoderOptions : PeachImage.EncoderOptions
Inheritance System.Object → EncoderOptions → PngEncoderOptions
| Properties | |
|---|---|
| ColorMode | Controls whether the encoder builds an indexed (PLTE, color type 3) palette instead of grayscale/ truecolor. Default Auto. Ignored (and indexed encoding skipped) whenever TransparentColor is set, since color-key transparency and a quantized palette target different scenarios and combining them isn’t supported. |
| CompressionLevel | The zlib compression level/speed tradeoff. Defaults to Default. |
| Dither | Whether to apply Floyd-Steinberg error-diffusion dithering when mapping pixels down to an indexed palette. Only makes a visible difference once quantization is actually lossy (i.e. Indexed with a source that has more than MaxColors distinct colors). Default false. |
| FilterStrategy | How the encoder picks a per-scanline filter type. Defaults to Adaptive. |
| Interlace | Whether to Adam7-interlace the output. Defaults to false (sequential scan). |
| MaxColors | The palette size, in [1, 256], indexed encoding quantizes down to. In Auto mode this also doubles as the distinct-color-count threshold below which indexed output is chosen automatically — the default of 256 only auto-indexes sources that already have at most 256 distinct colors, which is always lossless. In Indexed mode, a source with more distinct colors than this is quantized down via median-cut, which is lossy. Default 256. |
| TransparentColor | When set, and the source image has no alpha channel, encodes a tRNS chunk marking this single RGB (or gray, for single-channel sources) value as fully transparent, instead of the default of never emitting a color-key transparency chunk. Ignored for sources that already have a real alpha channel (Rgba32/Rgba64), which always encode with a true per-pixel alpha channel. |