Bug 456757 - gwenview doesn't open .tga files
Summary: gwenview doesn't open .tga files
Status: CONFIRMED
Alias: None
Product: gwenview
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.04.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
: 488314 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-07-15 13:30 UTC by Deniil
Modified: 2025-11-09 21:01 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
gwenview's log, while it's attempting to open a tga file (1.19 KB, text/x-log)
2022-07-15 13:30 UTC, Deniil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Deniil 2022-07-15 13:30:06 UTC
Created attachment 150646 [details]
gwenview's log, while it's attempting to open a tga file

SUMMARY
gwenview is unable to open any .tga files (tried exporting a .tga file in GIMP, to make sure that image is 100% valid, but it doesn't open them as well). 


STEPS TO REPRODUCE
1. Open any .tga image
2. Observe the error

OBSERVED RESULT
gwenview shows an error message "Loading 'something.tga' failed, Loading meta information"

EXPECTED RESULT
gwenview displays an image

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.18.11-arch-1 (64-bit)
(available in About System)
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
I attached gwenview's log in the attachments
Comment 1 David Korth 2024-03-13 15:23:22 UTC
I'm seeing this as well on gwenview-24.02.0 with KF6 6.0.0.
Comment 2 David Korth 2024-03-13 15:38:52 UTC
For reference, the TGA files work in Kolourpaint, but not Okular. (Okular says it's unable to read image data.)
Comment 3 David Korth 2024-03-13 15:59:15 UTC
org.kde.kdegraphics.gwenview.lib: QImageReader::read() using format hint "tga" failed: "Unknown error"
org.kde.kdegraphics.gwenview.lib: A bad Qt image decoder moved the buffer to 18 in a call to canRead()! Rewinding.
org.kde.kdegraphics.gwenview.lib: Image format is actually "ico" not "tga"

It seems to be an issue with the underlying QImageReader not handling TGA properly.

*** Fixed it, it seems to be an issue with qtimageformats.

My system has two TGA Qt image plugins installed: libqtga (part of qtimageformats), and kimg_tga (part of kimageformats). With both enabled, gwenview tries using libqtga first, which fails. Disabling libqtga causes gwenview to use kimg_tga instead, and that appears to work, at least for true-color TGAs. (8-bpp TGAs aren't loading for me with either one.)
Comment 4 Mirco Miranda 2025-08-22 12:52:22 UTC
*** Bug 488314 has been marked as a duplicate of this bug. ***
Comment 5 Mirco Miranda 2025-08-22 13:03:10 UTC
> My system has two TGA Qt image plugins installed: libqtga (part of qtimageformats), and kimg_tga (part of kimageformats). With both enabled, gwenview tries using libqtga first, which fails.

I did some research and it's documented in the QImageIOPlugin Detailed Description: "Different plugins can support different capabilities. For example, you may have one plugin that supports reading the GIF format, and another that supports writing. Qt will select the correct plugin for the job, depending on the return value of capabilities(). If several plugins support the same capability, Qt will select one arbitrarily."

I added a warn in the README.md of MR 395 (https://invent.kde.org/frameworks/kimageformats/-/merge_requests/395).

Since this is a Qt behavior, the only way is to "disable" the libqtga plugin (by renaming or deleting it). It's not a GwenView bug. I won't this issue anyway, because that would just open another one right away. :)

> (8-bpp TGAs aren't loading for me with either one.)

 When MR 395 will be merged, you should be able to open all kind of TGA files.