Opened 3 years ago
Last modified 2 years ago
#160 new defect
The image's transparent colour is included in the palette reduction
|Reported by:||Owned by:||pulkomandy|
My version: 2.8wip.3023
Is an image with a transparent background, the transparent colour being #FF00FF with 0 alpha. Of course it shows up in GrafX2 with 255 alpha.
However, the problem is, even if I set this colour as the background colour in the "Layers" right click dialog, it is still counted as part of the colour reduction algorithm. Import this image into GrafX2, set colour 0 as the background colour, and then go to the palette dialogue and reduce the image to two colours. You will see that the magenta colour has been changed, showing that GrafX2 counts it as a colour that needs to be adjusted. This happens whether or not you set the magenta as the background colour.
Shouldn't GrafX2 ignore it since it is the background colour and shouldn't try to change its appearance since the "transparent" colour does not matter to the image's overall colour composition?
Change History (4)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Well it could be ignored by the algorithm deciding which colors to keep in the final palette, and never merged with other colors when reducing. Changing which pixels are transparent when reducing colors seems a bit unexpected. (I don't know if we already do this or not)
But it will still be counted in the number of reduced colors. 256 colors is in fact 255+transparency, and likewise, 2 colors would be 1 color + transparency.
comment:3 by , 3 years ago
Grafx2 doesn't load this PNG variant perfectly, but it's a side problem (the sprite background color should be understood as transparent during truecolor -> indexed conversion)
I can see how there is a problem for sprites : let's say you have a GIF with a transparent part and 31 solid colors (total 32 useful indices in the palette).
If you try to reduce to 16, it should probably 'lock' the transparent index and pixels that use it, and only merge the other 31 colors into 15.
Even if you tried to reduce to 2, you should get :
- transparent part completely unchanged
- all other pixels colored into the average of all opaque pixels
Grafx2 provides options to manually tag colors to "protect", it works for things like transparent effect and "copy to spare - remap", but I noticed even this setting is not respected by the palette's color reduction function.
comment:4 by , 2 years ago
|Milestone:||2.8 → 2.9|
I don't really see the problem caused by this behavior