Indexed PNG background index hardcoded to 0
GIMP version:2.8.22
Operating System:Fedora 28
Package: [flatpak? Installer from gimp.org? If another installer, tell us where from] Fedora repo
Description of the bug
When exporting indexed PNG images with GIMP, the bKGD value is always set to 0.
This is supposed to be the palette index assigned to the background color.
Reproduction
Is the bug reproducible? [Always / Randomly / Happened only once ]
Bug is always reproducible.
Reproduction steps:
- Create index image with background color that is not palette index 0
- Export PNG
- Examine bKGD section and see that index is always 0
Expected result:
The background.index should be set to the index of the background color in the color selector.
Actual result:
The background index is always 0.
Additional information
This section of code is responsible for this behavior:
file-png.c:1789
if (pngvals.bkgd)
{
GimpRGB color;
guchar red, green, blue;
gimp_context_get_background (&color);
gimp_rgb_get_uchar (&color, &red, &green, &blue);
background.index = 0;
background.red = red;
background.green = green;
background.blue = blue;
background.gray = gimp_rgb_luminance_uchar (&color);
png_set_bKGD (pp, info, &background);
}
Edited by lillolollo