GIMP writes non-conforming BMP files in 24-bit mode
Environment/Versions
- GIMP version: 2.99.4
- Package: EXE installer
- Operating System: Windows 7 64-bit
Description of the bug
Open any image and export it as 24-bit BMP file. The resulting file is saved with BITFIELDS compression which is incorrect for 24-bit files per the official Microsoft docs. Please see https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv5header .
Quote:
BI_BITFIELDS: Specifies that the bitmap is not compressed and that the color masks for the red, green, and blue components of each pixel are specified in the bV5RedMask, bV5GreenMask, and bV5BlueMask members. This is valid when used with 16- and 32-bpp bitmaps.
Expected result:
BITFIELDS should be used only for 16- and 32-bit BMP files.
Actual result:
BITFIELDS is used for 24-bit BMP files as well.
Additional information
The resulting BMP files fail to be opened in spec-conforming applications.