TGA Export - Indexed colors 4bpp and 1bpp not working
Environment/Versions
- GIMP version: 2.10.28
- Package: Installer from gimp.org
- Operating System: Windows
When exporting a TGA file on an indexed-color image with 16 colors (4bpp) or less it mistakenly saves it as 256 color (8bpp) image. Same goes for monochrome bitmaps, they get saved as 8bpp instead of of 1bpp Description of the bug
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Create new image
- Set to indexed color mode with 2 colors (for 1bpp) or 16 color (for 4bpp)
- Export image as TGA file (checking/unchecking RLE doesn't matter)
…
Expected result: Image is saved with 4 bits per pixel when there are 16 colors or less and 1 bit per pixel when there are 2 colors
Actual result: Image is saved with 8 bits per pixel regardless of how many colors are used in the image. This can be verified by exporting the image as BMP (which works as intended) and checking the file sizes. The resulting file is 4x larger for a 4bpp image and 7x larger for a 1bpp image.
Additional information
If you have a backtrace for a crash or a warning, paste it here.