plug-ins: fix #9067 TGA files saved by Krita can't be opened

Krita had a bug where it incorrectly saved 4 for the alpha bits instead of
8. We will allow 4 and convert that to 8 to be able to read the incorrect
TGA images.

The likelyhood of real TGA images with 4 alphabits seems pretty low, so it
should not interfere with real images that have this set. We were not
supporting that anyway.
This commit is contained in:
Jacob Boerema
2023-02-14 15:11:47 -05:00
parent 375e91cb9d
commit 5f9415a641

View File

@ -556,6 +556,11 @@ load_image (GFile *file,
if (info.imageType == TGA_TYPE_GRAY && info.bpp == 16)
info.alphaBits = 8;
}
else if (info.alphaBits == 4 && info.imageType == TGA_TYPE_COLOR && info.bpp == 32)
{
/* Incorrect TGA saved by Krita, see issue #9067*/
info.alphaBits = 8;
}
switch (info.imageType)
{