Bug 354791

Summary: TGA files imported with Krita should be transparent but are not.
Product: [Applications] krita Reporter: Ghislain GIRARDOT <ghislain>
Component: File formatsAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: andrew.crouthamel, dimula73, freebox64, halla, jeskenis, kaerhon
Priority: NOR Keywords: investigated, triaged
Version: 2.9.7   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: archive with TGA file with transparency

Description Ghislain GIRARDOT 2015-11-03 13:47:44 UTC
If you export a tga file with Krita, no matter what the image is (could be a 100% black image with no transparency at all, 8bits, 16bits, with layers or no layers), and if you open it in Krita, it is half transparent.

But, if you open this exact same tga file in any other application, it is just fine. Gimp opens it as it is, without any transparency.

Also, if you create an image in Gimp, export it in tga, open it in krita, it is just fine and has no transparency either.

Reproducible: Always

Steps to Reproduce:
1. Create an image in Krita, no matter what. 100% pure black image would do the trick
2. Export in Tga
3. Open the Tga in Krita.

Actual Results:  
The opened tga is half transparent.

Expected Results:  
It shouldn't be.

The bug has been reproduced in 2.9.7 on linux as well as on windows with the lastest stable release.
Comment 1 kaerhon 2015-11-03 13:50:17 UTC
Same here on Xubuntu 15.04
Also, opening in a image viewer (Ristretto) doesn't show any issue
Comment 2 Halla Rempt 2015-11-03 17:26:04 UTC
Git commit e1b6822170a149b87de52a933920d955c450854a by Boudewijn Rempt.
Committed on 03/11/2015 at 17:12.
Pushed by rempt into branch 'calligra/2.9'.

M  +8    -4    krita/plugins/formats/tga/kis_tga_import.cpp

http://commits.kde.org/calligra/e1b6822170a149b87de52a933920d955c450854a
Comment 3 Przemek 2015-11-17 12:32:23 UTC
Created attachment 95559 [details]
archive with TGA file with transparency

I've tried opening TGA that has transparency (texture from 3d app - Modo 901) in Krita 2.9.9 (git a60bf1f) . Transparent areas open (and save) as black. Sample file attached.
Comment 4 mvowada 2017-01-04 10:15:07 UTC
(In reply to Ghislain GIRARDOT from comment #0)
> Actual Results:  
> The opened tga is half transparent.

I can't reproduce this problem on Ubuntu 14.04 with Krita 3.1.1.

(In reply to Przemek from comment #3)
> Created attachment 95559 [details]
> archive with TGA file with transparency
> 
> I've tried opening TGA that has transparency (texture from 3d app - Modo
> 901) in Krita 2.9.9 (git a60bf1f) . Transparent areas open (and save) as
> black. Sample file attached.

I'm able to reproduce this behaviour on Ubuntu 14.04 with Krita 3.1.1 (black areas instead of transparent)
Comment 5 Andrew Crouthamel 2018-09-15 14:40:54 UTC
I cannot reproduce the initial report in 4.2.0, but can confirm the second report. I've edited the title to reflect the latest TGA issue, but please submit one issue per bug report going forward. Thanks!

Application Version: 4.2.0
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1
Comment 6 Dmitry Kazakov 2019-04-24 12:47:45 UTC
Git commit 2bab65a95f9248fc83af4d7229c46d7fc960a7c4 by Dmitry Kazakov.
Committed on 24/04/2019 at 12:45.
Pushed by dkazakov into branch 'master'.

Fix loading broken TGA files

There are TGA files in the wild that report not having alpha
channel in the flags in 32-bit mode (although they have it).

Just ignore this TGA field and read alpha channel all the time.

M  +12   -2    plugins/impex/tga/kis_tga_import.cpp

https://invent.kde.org/kde/krita/commit/2bab65a95f9248fc83af4d7229c46d7fc960a7c4