Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to using GIF image for QT ?

How to using GIF image for QT ?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
23 Posts 4 Posters 1.6k 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.
  • N Offline
    N Offline
    Nguyen Thang Phong
    wrote on 31 Mar 2025, 12:07 last edited by
    #5

    @JonB
    I build qt static to custom installer framework is the path plugins/imageformats/qgif.lib, but when using binary creator to build app.exe using QLabel and QMovie but not display image ?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 31 Mar 2025, 12:14 last edited by
      #6

      See https://doc.qt.io/qt-6/qtplugin.html#Q_IMPORT_PLUGIN and https://doc.qt.io/qt-6/plugins-howto.html#static-plugin on how to use static plugins

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

      1 Reply Last reply
      2
      • N Offline
        N Offline
        Nguyen Thang Phong
        wrote on 31 Mar 2025, 12:50 last edited by
        #7

        @Christian-Ehrlicher @JonB
        I added QTPLUSGIN += qgif into installer.pro
        After, I build source installer framework done.
        But I tested not display GIF image.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 31 Mar 2025, 12:53 last edited by
          #8

          My post contains two links...

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

          1 Reply Last reply
          1
          • N Offline
            N Offline
            Nguyen Thang Phong
            wrote on 31 Mar 2025, 14:27 last edited by
            #9

            @Christian-Ehrlicher

            image.png
            I tried but not working

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 31 Mar 2025, 14:50 last edited by
              #10

              Then the path you given to QMovie does not exist. Check it

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

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Nguyen Thang Phong
                wrote on 1 Apr 2025, 03:59 last edited by
                #11

                @Christian-Ehrlicher
                I using pixmap to assign direct for GIF image but run not appear ?
                No away to solution ...

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 1 Apr 2025, 04:11 last edited by
                  #12

                  Again: Check if the file exists. E.g. 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

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Nguyen Thang Phong
                    wrote on 1 Apr 2025, 07:08 last edited by Nguyen Thang Phong 4 Jan 2025, 07:08
                    #13

                    @Christian-Ehrlicher @JonB
                    image.png
                    So, check supported image format to print formats bmp,pbm,pgm,png,ppm,xbm,xpm not found gif ?

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      JonB
                      wrote on 1 Apr 2025, 07:20 last edited by JonB 4 Jan 2025, 07:20
                      #14

                      I do not know for sure that GIF should appear in supportedImageFormats(), though I agree I would have thought it should.
                      I suggested earlier that you try to display a GIF as an image on a QLabel, not in a QMovie.
                      @Christian-Ehrlicher asked you to verify that the path to the GIF file you test really does exist via QFile::exists().

                      J 1 Reply Last reply 1 Apr 2025, 12:21
                      0
                      • N Offline
                        N Offline
                        Nguyen Thang Phong
                        wrote on 1 Apr 2025, 07:32 last edited by
                        #15

                        @Christian-Ehrlicher @JonB
                        image.png
                        I tried add to pixmap

                        J 1 Reply Last reply 1 Apr 2025, 07:47
                        0
                        • N Nguyen Thang Phong
                          1 Apr 2025, 07:32

                          @Christian-Ehrlicher @JonB
                          image.png
                          I tried add to pixmap

                          J Offline
                          J Offline
                          JonB
                          wrote on 1 Apr 2025, 07:47 last edited by
                          #16

                          @Nguyen-Thang-Phong
                          I do not use resources and I do not know whether that ../..../additonal.qrc path is right.
                          What does QFile::exists(":/loading.gif") return?
                          If you place a .gif file in your actual file system and try

                          qDebug() << QFile::exists("c:/full/path/to/file.gif");
                          // `label` is some `QLabel *` you have created and is visible in your UI
                          label->setPixmap(new QPixmap("c:/full/path/to/file.gif"));
                          

                          (I think the above is right, untested, adjust as necessary) does that work?

                          Otherwise I guess it is indeed a "static" issue, and only someone like @Christian-Ehrlicher knows what the issue might be.

                          1 Reply Last reply
                          0
                          • J JonB
                            1 Apr 2025, 07:20

                            I do not know for sure that GIF should appear in supportedImageFormats(), though I agree I would have thought it should.
                            I suggested earlier that you try to display a GIF as an image on a QLabel, not in a QMovie.
                            @Christian-Ehrlicher asked you to verify that the path to the GIF file you test really does exist via QFile::exists().

                            J Offline
                            J Offline
                            JoeCFD
                            wrote on 1 Apr 2025, 12:21 last edited by JoeCFD 4 Jan 2025, 12:22
                            #17

                            @JonB I play a GIF file in a QMovie in a QLabel.

                            J 1 Reply Last reply 1 Apr 2025, 12:45
                            0
                            • N Nguyen Thang Phong
                              31 Mar 2025, 09:00

                              @JonB
                              m_movie = new QMovie(gif);
                              m_label->setMovie(m_movie);
                              m_movie->start();
                              and add QTPLUGIN += qgif into file .pro
                              But not display when check using
                              qDebug() << "supported formats: " << QImageReader::supportedImageFormats();
                              supported formats: QList("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

                              J Offline
                              J Offline
                              JoeCFD
                              wrote on 1 Apr 2025, 12:25 last edited by JoeCFD 4 Jan 2025, 14:05
                              #18

                              @Nguyen-Thang-Phong Did you try the following in the pro file?

                              CONFIG   += static
                              # For static plugins
                              static {
                                  # Include the GIF plugin
                                  QTPLUGIN += qgif
                              }
                              
                              N 1 Reply Last reply 2 Apr 2025, 02:54
                              0
                              • J JoeCFD
                                1 Apr 2025, 12:21

                                @JonB I play a GIF file in a QMovie in a QLabel.

                                J Offline
                                J Offline
                                JonB
                                wrote on 1 Apr 2025, 12:45 last edited by
                                #19

                                @JoeCFD said in How to using GIF image for QT ?:

                                @JonB I play a GIF file in a QMovie in a QLabel.

                                I know you do. And I have suggested removing the QMovie level, to eliminate that, by assigning a created QPixmap from a GIF file directly to the QLabel, which can display GIF images, to see if that works. And I have also suggested using an external, actual GIF file instead of one in a Qt resource, and various QFile::exists() checks to verify the file or resource can be found. Up to you whether you do these things, but they check for various problems. It may well be that your issue is static-related and these will not show anything wrong, but it is what I would do before proceeding.

                                J 1 Reply Last reply 1 Apr 2025, 13:07
                                0
                                • J JonB
                                  1 Apr 2025, 12:45

                                  @JoeCFD said in How to using GIF image for QT ?:

                                  @JonB I play a GIF file in a QMovie in a QLabel.

                                  I know you do. And I have suggested removing the QMovie level, to eliminate that, by assigning a created QPixmap from a GIF file directly to the QLabel, which can display GIF images, to see if that works. And I have also suggested using an external, actual GIF file instead of one in a Qt resource, and various QFile::exists() checks to verify the file or resource can be found. Up to you whether you do these things, but they check for various problems. It may well be that your issue is static-related and these will not show anything wrong, but it is what I would do before proceeding.

                                  J Offline
                                  J Offline
                                  JoeCFD
                                  wrote on 1 Apr 2025, 13:07 last edited by
                                  #20

                                  @JonB It is not a QMovie issue. May be better to try to make his code to run dynamically with gif plugin first. And then build his app with gif plugin statically.

                                  J 1 Reply Last reply 1 Apr 2025, 13:14
                                  1
                                  • J JoeCFD
                                    1 Apr 2025, 13:07

                                    @JonB It is not a QMovie issue. May be better to try to make his code to run dynamically with gif plugin first. And then build his app with gif plugin statically.

                                    J Offline
                                    J Offline
                                    JonB
                                    wrote on 1 Apr 2025, 13:14 last edited by JonB 4 Jan 2025, 13:15
                                    #21

                                    @JoeCFD
                                    I understand, but was trying to simplify, and follow @Christian-Ehrlicher's suggestion of checking file exists and removing resources from OP's situation, as I don't know what he actually has there/where.

                                    If you are happy to take over here that's fine :) If the fact that the OP's supportedImageFormats() does not include GIF indicates that is where the problem lies then obviously all my questions are not relevant.

                                    1 Reply Last reply
                                    0
                                    • J JoeCFD
                                      1 Apr 2025, 12:25

                                      @Nguyen-Thang-Phong Did you try the following in the pro file?

                                      CONFIG   += static
                                      # For static plugins
                                      static {
                                          # Include the GIF plugin
                                          QTPLUGIN += qgif
                                      }
                                      
                                      N Offline
                                      N Offline
                                      Nguyen Thang Phong
                                      wrote on 2 Apr 2025, 02:54 last edited by
                                      #22

                                      @JoeCFD
                                      Thank you, I will try

                                      1 Reply Last reply
                                      0
                                      • N Offline
                                        N Offline
                                        Nguyen Thang Phong
                                        wrote on 2 Apr 2025, 08:15 last edited by
                                        #23

                                        @Christian-Ehrlicher @JonB @JoeCFD
                                        I have tried the solution, but not GIF image format to work.

                                        1 Reply Last reply
                                        0

                                        14/23

                                        1 Apr 2025, 07:20

                                        • Login

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