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 doesn't seem to support older GIF images?
Forum Updated to NodeBB v4.3 + New Features

QImage doesn't seem to support older GIF images?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 598 Views 2 Watching
  • 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.
  • N Offline
    N Offline
    NightShadeI
    wrote on last edited by
    #1

    QtImage does not seem to support older images

    Hi, I have an older image in the form of a .gif

    If I convert it online to some PNG it works fine, but not in its older format. Is this some bug in QT? (example below)

    isNull() always returns true

    QImage myImage{":/example.gif"};
    std::cout << (int)myImage.isNull() << std::endl;
    

    example.gif

    Christian EhrlicherC JonBJ 2 Replies Last reply
    0
    • N NightShadeI

      QtImage does not seem to support older images

      Hi, I have an older image in the form of a .gif

      If I convert it online to some PNG it works fine, but not in its older format. Is this some bug in QT? (example below)

      isNull() always returns true

      QImage myImage{":/example.gif"};
      std::cout << (int)myImage.isNull() << std::endl;
      

      example.gif

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @NightShadeI said in QImage doesn't seem to support older GIF images?:

      QImage myImage{":/example.gif"};

      I doubt this - are you sure :/example.gif is correct? Please check with QFile::exists()

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      N 1 Reply Last reply
      1
      • N NightShadeI

        QtImage does not seem to support older images

        Hi, I have an older image in the form of a .gif

        If I convert it online to some PNG it works fine, but not in its older format. Is this some bug in QT? (example below)

        isNull() always returns true

        QImage myImage{":/example.gif"};
        std::cout << (int)myImage.isNull() << std::endl;
        

        example.gif

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @NightShadeI
        I'm with @Christian-Ehrlicher on this: please check 100.00% that :/example.gif really, really is right, because I/we think it's not, and that's why you're getting a null image. If necessary try putting example.gif as an external file instead of embedded resource to verify.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @NightShadeI said in QImage doesn't seem to support older GIF images?:

          QImage myImage{":/example.gif"};

          I doubt this - are you sure :/example.gif is correct? Please check with QFile::exists()

          N Offline
          N Offline
          NightShadeI
          wrote on last edited by NightShadeI
          #4

          @Christian-Ehrlicher
          @JonB

          I have verified it does exist with QFile::exists (returns true) and also tried QImage::load , and it still does not work with this

          Like I mentioned, If I put the image in some online converter to a png, and then use that png this does work. So I suspect Qt is not supporting this type of image.

          LIke I mentioned the format here is likely very old (im talking maybe 1996). Can you try download the image and see if you get this issue too?

          Chris KawaC JonBJ 2 Replies Last reply
          0
          • N NightShadeI

            @Christian-Ehrlicher
            @JonB

            I have verified it does exist with QFile::exists (returns true) and also tried QImage::load , and it still does not work with this

            Like I mentioned, If I put the image in some online converter to a png, and then use that png this does work. So I suspect Qt is not supporting this type of image.

            LIke I mentioned the format here is likely very old (im talking maybe 1996). Can you try download the image and see if you get this issue too?

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @NightShadeI Works for me. Do you have the gif plugin in <your app>/imageformats/ directory deployed along with your app? Do other gif files work?

            N 1 Reply Last reply
            2
            • N NightShadeI

              @Christian-Ehrlicher
              @JonB

              I have verified it does exist with QFile::exists (returns true) and also tried QImage::load , and it still does not work with this

              Like I mentioned, If I put the image in some online converter to a png, and then use that png this does work. So I suspect Qt is not supporting this type of image.

              LIke I mentioned the format here is likely very old (im talking maybe 1996). Can you try download the image and see if you get this issue too?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @NightShadeI
              Same for me as for @Chris-Kawa. Just try Qt Designer, put a QLabel on a form, use pixmap property, drop down arrow, Choose file..., pick the .gif. I see it fine. You can probably do it for a resource file too. Does that work for you in Creator/Designer?

              1 Reply Last reply
              0
              • Chris KawaC Chris Kawa

                @NightShadeI Works for me. Do you have the gif plugin in <your app>/imageformats/ directory deployed along with your app? Do other gif files work?

                N Offline
                N Offline
                NightShadeI
                wrote on last edited by
                #7

                @Chris-Kawa

                Ah that is embarassing, yes I hadn't added that plugin directory .. that's exactly the issue. Sorry to waste both of your times , thanks for the help also though :)

                1 Reply Last reply
                0
                • N NightShadeI has marked this topic as solved on

                • Login

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