Skip to content

FIX: Indexed PNG background index hardcoded to 0 (#3048)

Ghost User requested to merge (removed):bug3048 into gimp-2-8

This is a fix to correctly identify the matching palette entry for the currently selected BG color.

The code checks if the image is indexed then iterates through the PNG colormap to find the first matching palette entry. It uses an anonymous struct to interrogate the RGB colors in the colormap. The "most correct" way would be to use gimp_image_get_colormap_entry, however this is implemented in the core code and not exposed via libgimp, so the function is not available.

This fix correctly identifies the background color palette entry instead of hardcoding 0.

Merge is against 2.8 because master would segfault when loading/saving files and had all sorts of funky errors.

I have compiled 2.8.22 and verified the plugin behaves as desired/expected.

Merge request reports

Loading