Bug 464484 - TGA files not saved correctly
Summary: TGA files not saved correctly
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 5.1.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-19 01:11 UTC by Alexandre Prokoudine
Modified: 2023-02-01 20:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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