Exporting an indexed PNG image with transparent pixels adds color to colormap
Environment/Versions
- GIMP version: 2.10.18, 2.10.30
- Package: ubuntu-focal-universe (deb), flatpak, installer from gimp.org (exe)
- Operating System: GNU/Linux (Ubuntu 20.04.3 LTS), Windows
When exporting a PNG image in indexed color mode that contains at least one fully transparent pixel, an extra color will be added at the beginning of the colormap. The color values of the transparent pixels will be the new color. Repeating this process will add even more colors to the colormap. Description of the bug
Colormap of the original image:
Colormap of the imported image (colors may be different): (color 0 is used in transparent areas)
Colormap of the image after exporting and re-importing twice: (color 0 is used in transparent areas, color 1 is now unused)
Reproduction
Is the bug reproducible? Always
Reproduction steps:
-
Create a new image (
File -> New...
) with transparency (setFill with:
underAdvanced Options
toTransparency
) -
Convert the image to indexed color (
Image -> Mode -> Indexed...
) (options don't matter) -
Export as a PNG image (
File -> Export As...
) (options don't matter)
Expected result: The imported image should have the same colormap as the original image.
Actual result: The imported image will have an extra color at the beginning of the colormap.
Edited by Galactikoopa