Only check the tRNS (trans) chunk if the image is still palettized
This commit is contained in:
parent
4d847f4223
commit
06c0932ab4
|
@ -909,11 +909,13 @@ static png_bytep *PNG_Read(
|
||||||
|
|
||||||
// If any of the tRNS colors have an alpha lower than 0xFF, and that
|
// If any of the tRNS colors have an alpha lower than 0xFF, and that
|
||||||
// color is present on the image, the palette flag is disabled.
|
// color is present on the image, the palette flag is disabled.
|
||||||
|
if (usepal)
|
||||||
|
{
|
||||||
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
|
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
|
||||||
|
|
||||||
if (trans && trans_num == 256)
|
if (trans && trans_num == 256)
|
||||||
{
|
{
|
||||||
int i;
|
INT32 i;
|
||||||
for (i = 0; i < trans_num; i++)
|
for (i = 0; i < trans_num; i++)
|
||||||
{
|
{
|
||||||
// libpng will transform this image into RGB even if
|
// libpng will transform this image into RGB even if
|
||||||
|
@ -926,6 +928,7 @@ static png_bytep *PNG_Read(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (usepal)
|
if (usepal)
|
||||||
*use_palette = true;
|
*use_palette = true;
|
||||||
|
|
Loading…
Reference in a new issue