Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage and TGA support in c++

QImage and TGA support in c++

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dokif
    wrote on last edited by
    #1

    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.html

    But 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?

    KillerSmathK 1 Reply Last reply
    0
    • D dokif

      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.html

      But 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?

      KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      @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.html

      TGA 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)

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      D 2 Replies Last reply
      4
      • D Offline
        D Offline
        dokif
        wrote on last edited by
        #3

        Thanks a lot! I'll try right now

        1 Reply Last reply
        0
        • KillerSmathK KillerSmath

          @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.html

          TGA 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)

          D Offline
          D Offline
          dokif
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0
          • KillerSmathK KillerSmath

            @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.html

            TGA 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)

            D Offline
            D Offline
            dokif
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved