Options for encoding BMP images
optional
bitsPerPixel: 1
| 4
| 8
| 16
| 24
| 32
Bits per pixel (1, 4, 8, 16, 24, or 32).
Default: Auto-detected from input channels
- channels=1 (grayscale) → 8-bit
- channels=3 (RGB) → 24-bit
- channels=4 (RGBA) → 32-bit
optional
compression: 0
| 1
| 2
| 3
| 6
BMP compression method identifiers.
- 0 (BI_RGB) - No compression. Raw pixel data.
- 1 (BI_RLE8) - 8-bit run-length encoding. 256-color indexed only.
- 2 (BI_RLE4) - 4-bit run-length encoding. 16-color indexed only.
- 3 (BI_BITFIELDS) - Uncompressed with custom RGB bit masks.
- 6 (BI_ALPHABITFIELDS) - Uncompressed with custom RGBA bit masks.
Default: 0 (BI_RGB)
optional
headerType: HeaderType
BMP header format type. Determines header size and features.
BITMAPINFOHEADER: 40 bytes. Basic format.BITMAPV4HEADER: 108 bytes. Embedded masks, color space, gamma support.BITMAPV5HEADER: 124 bytes. Adds ICC profiles and rendering intent.
Default: BITMAPINFOHEADER
BMP image orientation.
false- bottom-up (standard BMP)true- top-down
Default: false
Color palette for indexed formats (1, 4, 8-bit).
If not provided, palette will be generated automatically.
optional
bitfields: BitfieldMasks
Bitfield masks for BI_BITFIELDS/BI_ALPHABITFIELDS compression.
If not provided, default masks will be used:
- 16-bit - RGB565 (5-6-5)
- 32-bit - BGRA (8-8-8-8)