plug-ins: Fix indexed transparent PNG export

Resolves #9933.

We used png_get_valid (pp, info, PNG_INFO_tRNS) to check if
an indexed PNG had transparency when exporting.
However, this function does not return TRUE/FALSE but instead
the contents of that PNG chunk. Since we use index 0 for transparency,
this function always returns 0. The non-transparent indexed export code
ran regardless, creating incorrect PNGs.
We set pngg.has_trns earlier if the image has transparency, so it's safer
to use this variable instead.
This commit is contained in:
Alx Sa 2023-12-23 21:40:14 +00:00
parent 11b7e4cded
commit dd10433c37
1 changed files with 1 additions and 1 deletions

View File

@ -2065,7 +2065,7 @@ save_image (GFile *file,
/* If we're dealing with a paletted image with
* transparency set, write out the remapped palette */
if (png_get_valid (pp, info, PNG_INFO_tRNS))
if (pngg.has_trns)
{
guchar inverse_remap[256];