From 5f9415a641e2f625e631f0438f12dff1d9421399 Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Tue, 14 Feb 2023 15:11:47 -0500 Subject: [PATCH] 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. --- plug-ins/common/file-tga.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c index 250c6ed920..40598159e4 100644 --- a/plug-ins/common/file-tga.c +++ b/plug-ins/common/file-tga.c @@ -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) {