Images with alpha exported as XPM include color None even if not used
GIMP version | 2.10.12 |
Operating System | Void-Linux x86_64 |
Package | from distro |
Description of the bug
If take an image with transparency, flatten it and export as XPM, the color None will still be present on the palette, even though not used on any pixel.
If I create an image, add an alpha channel, make all pixels black and opaque and then export it as XPM, the color None will still be present on the palette, even though not used on any pixel.
Looking at the code, I found that the plugin just checks whether the image has or not an alpha channel to add None to the palette, even though it iterates through all the pixels to generate regular colors.
Also I would like to note that allowing -1 as a threshold option would be massively helpful, so it wouldn't be necessary to flatten, export and then undo.
Reproduction
- Create new image
- Make it completely black
- Add alpha channel (but no transparent pixel)
Flatten it to be sure- Export XPM
Expected result:
Palette with one color: #000000.
Actual result:
Palette with two colors, None and #000000.