Unsolved QImage and TGA support in c++
-
Hi,
I need to open tga images with Qt in c++. I've read that it's already supported here: https://doc.qt.io/qt-5/qtimageformats-index.htmlBut loading with both QImage::load or directly with QImage("path/to/tga/file.tga") returns NULL.
Should i take extra steps to open tga files?
-
@dokif
I tested a Version using QImageReader but i got the same problem.
But when i readed the documentation.
https://doc.qt.io/archives/qt-4.8/qimagereader.htmlTGA support only extends to reading non-RLE compressed files.
You can work around this problem with the solution of this thread:
https://forum.qt.io/topic/74712/qimage-from-tga-with-alpha/11
Create a function to read TGA compressed files and return a QImage.
QImage loadTga(const char* filePath, bool &success)
-
Thanks a lot! I'll try right now
-
@KillerSmath It worked flawlessly! Thanks a lot. Now i also need to open dds images. I'll search a bit on where to find and how to compile the module.
-
@KillerSmath May be i got happy to soon.. that function only loads correctly for me 24 bit compressed tga.. but it fails with 32 bits (and does not support 16 bit). Also, i think it does not support transparency.