PngPixelLayout Enum
The sample layout written by PngEncoder.
public enum PngPixelLayoutFields
| Name | Value | Description |
|---|---|---|
Auto | 0 | The color type and the bit depth follow the pixel format, losslessly: grayscale for PixelFormat.Gray8/PixelFormat.Gray16, grayscale with alpha for PixelFormat.La16/PixelFormat.La32/PixelFormat.A8, RGB for PixelFormat.Rgb24/PixelFormat.Rgb48 and RGBA for the other pixel formats with alpha, with 16-bit samples for the 16-bit pixel formats. This is the default: the mapping never depends on the pixels, and a palette is never written. With PngOptimization.MinimumSize, the layout is the smallest exact one instead, a palette included, and with PngOptimization.Layout the exact one with the smallest unfiltered data, for a still image. |
Indexed | 1 | Indexed color (color type 3): indexes into a palette (PLTE) of at most 256 colors, each with its own alpha (tRNS, written only when an entry is not opaque). The pixels are stored exactly: the palette holds every distinct combination of color and alpha, the color of fully transparent pixels included, in a deterministic order, and the indexes use the smallest bit depth that holds it (1, 2, 4 or 8 bits). The encoder never reduces colors: an image with more than 256 distinct colors is rejected with an UnsupportedImageFeatureException before anything of it is written, and so is a pixel of a 16-bit pixel format whose samples 8 bits cannot represent exactly (a palette stores 8-bit samples). A file has a single palette, written before the first image: it holds the colors of every image that is known at that point. The eager save methods know every frame and the poster of an animation; a sequential ImageWriter<TPixel> only knows the first image it is given, so every later frame must use the colors of that image, and a frame that does not is rejected before anything of it is written. An indexed file is read back as PixelFormat.Rgba32, whatever the pixel format it was written from. An ICC profile must be an RGB profile, also for a grayscale pixel format. With PngOptimization.MinimumSize, the palette holds the same colors (plus a transparent entry for an animation), and the indexes are 8-bit when they compress smaller than at the smallest bit depth, and always in an animation. |