Wrong biCompression value in exported uncompressed 8 bit bmp ?
GIMP version: 2.10.22 Operating System: Windows Package: Installer from gimp.org
Description of the bug
When I export uncompressed 8-bit bmp I see biCompression field value 3 (BI_BITFIELDS) in bmp header.
According to "2.1.1.7 Compression Enumeration" on https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/4e588f70-bd92-4a6f-b77f-35d0feaf7a57
typedef enum { BI_RGB = 0x0000, BI_RLE8 = 0x0001, BI_RLE4 = 0x0002, BI_BITFIELDS = 0x0003, BI_JPEG = 0x0004, BI_PNG = 0x0005, BI_CMYK = 0x000B, BI_CMYKRLE8 = 0x000C, BI_CMYKRLE4 = 0x000D } Compression;
BI_RGB: The bitmap is in uncompressed red green blue (RGB) format that is not compressed and does not use color masks.
BI_BITFIELDS: The bitmap is not compressed, and the color table consists of three DWORD (defined in [MS-DTYP] section 2.2.9) color masks that specify the red, green, and blue components, respectively, of each pixel. This is valid when used with 16 and 32-bits per pixel bitmaps.
My bmp has 8 bits per pixel, so using BI_BITFIELDS in this case looks incorrect. I'm definitely not expert in this area; usually (from my practice) this field has value 0 (BI_RGB).
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Open 8 bit bmp.
- Export into bmp without compression.
- Check value in exported file.
Expected result: 0 (BI_RGB) Actual result: 3 (BI_BITFIELDS)