Bug 464484

Summary: TGA files not saved correctly
Product: [Applications] krita Reporter: Alexandre Prokoudine <alexandre.prokoudine>
Component: File formatsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.1.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alexandre Prokoudine 2023-01-19 01:11:53 UTC
Krita saves 8-bit RGBA TGA files in a way that appears to be wrong.

GIMP reports this upon an attempt to open such a file: Unhandled sub-format in '/home/alex/Pictures/test.tga' (type = 2, bpp = 32, alpha = 4) (related bug report: https://gitlab.gnome.org/GNOME/gimp/-/issues/9067)

From #krita:

Lynx3d:

"Bits 3-0 - number of attribute bits associated with each pixel. (...) For Targa 32, it should be 8." so it seems wrong indeed
that's what krita does: s << quint8(hasAlpha ? 0x24 : 0x20);   // top left image (0x20) + 8 bit alpha (0x4):
Comment 1 Bug Janitor Service 2023-01-28 18:25:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1728
Comment 2 Invent Merge Service 2023-02-01 20:52:19 UTC
Git commit f3e913d6aed527a493ad13855975c5064bdaca87 by Merge Service, on behalf of Freya Lupen.
Committed on 01/02/2023 at 20:51.
Pushed by merge-service into branch 'master'.

Fix writing alpha bits flag in .tga

We're writing 8-bit alpha (0x8). Krita assumes this value
on reading, but it should still be written correctly,
so that other programs can read it.

Part-of: <https://invent.kde.org/graphics/krita/-/merge_requests/1728>

M  +4    -1    plugins/impex/tga/kis_tga_export.cpp

https://invent.kde.org/graphics/krita/commit/f3e913d6aed527a493ad13855975c5064bdaca87