Enum BmpPixelFormat
The pixel layout a BMP is written with.
public enum BmpPixelFormat
Fields
Auto = 024-bit when every pixel is opaque, else 32-bit with alpha.
Bgr24 = 524-bit blue, green and red. Alpha is dropped, not blended onto a background.
Bgr555 = 716-bit 5-5-5 blue, green and red, the default 16-bit layout every reader opens. Alpha is dropped.
Bgr565 = 816-bit 5-6-5 blue, green and red, with a V4 header and bit-field masks. Alpha is dropped.
Bgra32 = 632-bit blue, green, red and alpha, with a V4 header and bit-field masks.
Bgra5551 = 916-bit 5-5-5 blue, green and red and a 1-bit alpha, with a V4 header and bit-field masks.
Indexed1 = 1A 2-color palette.
Indexed2 = 2A 4-color palette, a Windows CE layout many desktop readers cannot open.
Indexed4 = 3A palette of up to 16 colors.
Indexed8 = 4A palette of up to 256 colors.
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 });