Export to 16-bit PNG incorrectly sets background color to 8-bit
GIMP version:2.99.1
When exporting to PNG files, (if "Save background color" is ticked) the background color is always set to 8-bit, even for 16-bit PNG files. But the color specified in png_set_bKGD() has to match the export bit-depth.
(See PNG file specification, about 3/4 page down.)
I ran into this while using GIMP-created PNGs to test some PNG-reading code I wrote. Drove me nuts. ;o)
Reproduction
Is the bug reproducible? [Always]
Reproduction steps:
- Export a 16-bit PNG with saved background color
- Run "pngcheck -v my16bitimage.png | grep -v IDAT"
- Look for "chunk bKGD at offset ..."
Expected result: 16-bit color spec
Actual result: 8-bit color spec
I am attaching a patch with a proposed fix.
Regards
Rupert 0001-On-export-to-16-bit-PNG-the-background-color-bKGD-ne.patch