Class BmpWriterOptions
Options for writing BMP.
public sealed class BmpWriterOptions : WriterOptions
- Inheritance
-
BmpWriterOptions
- Inherited Members
Examples
// Auto (the default): 24-bit when every pixel is opaque, 32-bit with alpha otherwise.
image.Save("duck.bmp");
// A 16-color palette, built from the image and dithered.
image.Save("duck-16.bmp", new BmpWriterOptions { PixelFormat = BmpPixelFormat.Indexed4 });
// The same palette, run-length encoded (RLE4): smaller where the image has flat areas.
image.Save("duck-16-rle.bmp", new BmpWriterOptions { PixelFormat = BmpPixelFormat.Indexed4, RunLength = true });
Properties
Default
Gets the default options.
public static BmpWriterOptions Default { get; }
Property Value
Palette
Gets how a palette is built for the indexed layouts when the image has more colors than fit: the color limit (capped at the layout's) and dithering. Alpha is dropped first, since BMP palettes are opaque.
public PaletteOptions Palette { get; init; }
Property Value
Remarks
Defaults to Default: up to 256 colors, Floyd–Steinberg dithering.
PixelFormat
Gets the pixel layout. Defaults to Auto.
public BmpPixelFormat PixelFormat { get; init; }
Property Value
RunLength
Gets whether Indexed4 and Indexed8 pixels are run-length encoded (RLE4 and RLE8), which shrinks images with flat areas. Other layouts cannot be: saving one with this set throws. Defaults to false.
public bool RunLength { get; init; }