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 take in a JPG
Forum Updated to NodeBB v4.3 + New Features

QImage doesn't take in a JPG

Scheduled Pinned Locked Moved Solved General and Desktop
30 Posts 5 Posters 13.5k Views 3 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.
  • jsulmJ jsulm

    @Rapidrain Sure it exists, but does it contain the JPEG plug-in? It should be named like libqjpeg.so
    You do not have to add any of them to your compile/link config!
    When deploying your app later you just need to make sure you deploy all needed plug-ins as well. See http://doc.qt.io/qt-5/linux-deployment.html

    R Offline
    R Offline
    Rapidrain
    wrote on last edited by
    #13

    @jsulm there is qjpeg.dll in the imageformats directory but ....
    libqjpeg.so is nowhere on my computers.
    I have used Qt for years and have countless versions here.
    I have never seed libqjpeg.so

    jsulmJ 1 Reply Last reply
    0
    • R Rapidrain

      @jsulm there is qjpeg.dll in the imageformats directory but ....
      libqjpeg.so is nowhere on my computers.
      I have used Qt for years and have countless versions here.
      I have never seed libqjpeg.so

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #14

      @Rapidrain Sorry forgot that you're on Windows. qjpeg.dll is what you need.
      Try to start your app with QT_DEBUG_PLUGINS environment variable set to 1 (you can add it in QtCreator Run settings of your project).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Rapidrain Sorry forgot that you're on Windows. qjpeg.dll is what you need.
        Try to start your app with QT_DEBUG_PLUGINS environment variable set to 1 (you can add it in QtCreator Run settings of your project).

        R Offline
        R Offline
        Rapidrain
        wrote on last edited by
        #15

        @jsulm said in QImage doesn't take in a JPG:

        QT_DEBUG_PLUGINS

        I'm not using QtCreator

        jsulmJ 1 Reply Last reply
        0
        • R Rapidrain

          @jsulm said in QImage doesn't take in a JPG:

          QT_DEBUG_PLUGINS

          I'm not using QtCreator

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #16

          @Rapidrain When do it wherever you're developing. If you start your app from a terminal:

          QT_DEBUG_PLUGINS=1 && ./my_app
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Rapidrain When do it wherever you're developing. If you start your app from a terminal:

            QT_DEBUG_PLUGINS=1 && ./my_app
            
            R Offline
            R Offline
            Rapidrain
            wrote on last edited by
            #17

            @jsulm said in QImage doesn't take in a JPG:

            QT_DEBUG_PLUGINS=1 && ./my_app

            I tried what you suggested, it doesn't help.

            0_1500978497455_Cmd_calling_the_exe.jpg

            jsulmJ 1 Reply Last reply
            0
            • R Rapidrain

              @jsulm said in QImage doesn't take in a JPG:

              QT_DEBUG_PLUGINS=1 && ./my_app

              I tried what you suggested, it doesn't help.

              0_1500978497455_Cmd_calling_the_exe.jpg

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #18

              @Rapidrain Sorry, again forgot that you're on Windows:

              set QT_DEBUG_PLUGINS=1
              ./my_app
              

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              R 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Rapidrain Sorry, again forgot that you're on Windows:

                set QT_DEBUG_PLUGINS=1
                ./my_app
                
                R Offline
                R Offline
                Rapidrain
                wrote on last edited by
                #19

                @jsulm said in QImage doesn't take in a JPG:

                QT_DEBUG_PLUGINS=1

                guess what?
                It doesn't help.
                Can you suggest a chain of options I must add to g++ when compiling and linking this code?

                0_1500984817989_Cmd2_call_exe.jpg

                jsulmJ 1 Reply Last reply
                0
                • R Rapidrain

                  @jsulm said in QImage doesn't take in a JPG:

                  QT_DEBUG_PLUGINS=1

                  guess what?
                  It doesn't help.
                  Can you suggest a chain of options I must add to g++ when compiling and linking this code?

                  0_1500984817989_Cmd2_call_exe.jpg

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #20

                  @Rapidrain said in QImage doesn't take in a JPG:

                  Can you suggest a chain of options I must add to g++ when compiling and linking this code?

                  As I said before: there is no need to add any options to compiler/linker. The plug-ins are automatically loaded at runtime when needed. You either have some issues with your JPEG plug-in or with the picture you're trying to display. See http://doc.qt.io/qt-5/debug.html
                  After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  R 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Rapidrain said in QImage doesn't take in a JPG:

                    Can you suggest a chain of options I must add to g++ when compiling and linking this code?

                    As I said before: there is no need to add any options to compiler/linker. The plug-ins are automatically loaded at runtime when needed. You either have some issues with your JPEG plug-in or with the picture you're trying to display. See http://doc.qt.io/qt-5/debug.html
                    After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build?

                    R Offline
                    R Offline
                    Rapidrain
                    wrote on last edited by
                    #21

                    @jsulm , What exactly do you mean "do you test a debug build" ???

                    jsulmJ R 2 Replies Last reply
                    0
                    • R Rapidrain

                      @jsulm , What exactly do you mean "do you test a debug build" ???

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #22

                      @Rapidrain Did you build your app in debug or release mode?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      R 1 Reply Last reply
                      0
                      • R Rapidrain

                        @jsulm , What exactly do you mean "do you test a debug build" ???

                        R Offline
                        R Offline
                        Rapidrain
                        wrote on last edited by Rapidrain
                        #23

                        @Rapidrain After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build?

                        the statement "set QT_DEBUG_PLUGINS=1" is not a communication with my app. It is a communication with the Windows Operating System. Why should my app output a "lot of text" ?? It hasn't even started yet.

                        jsulmJ 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Rapidrain Did you build your app in debug or release mode?

                          R Offline
                          R Offline
                          Rapidrain
                          wrote on last edited by
                          #24

                          @jsulm I am building it at the moment in Debug mode

                          1 Reply Last reply
                          0
                          • R Rapidrain

                            @Rapidrain After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build?

                            the statement "set QT_DEBUG_PLUGINS=1" is not a communication with my app. It is a communication with the Windows Operating System. Why should my app output a "lot of text" ?? It hasn't even started yet.

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by jsulm
                            #25

                            @Rapidrain said in QImage doesn't take in a JPG:

                            It is a communication with the Windows Operating System

                            wrong, it just sets an environment variable - Windows does not care about it at all. Qt checks this variable at runtime and if it is set it prints debug output while loading plug-ins. That's how environment variable work.

                            You can see which variables are set executing "set" command on Windows.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            R 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @Rapidrain said in QImage doesn't take in a JPG:

                              It is a communication with the Windows Operating System

                              wrong, it just sets an environment variable - Windows does not care about it at all. Qt checks this variable at runtime and if it is set it prints debug output while loading plug-ins. That's how environment variable work.

                              You can see which variables are set executing "set" command on Windows.

                              R Offline
                              R Offline
                              Rapidrain
                              wrote on last edited by
                              #26

                              @jsulm so when I set a windows environment variable to a value, I am not communicating with the Windows OS in any way??

                              jsulmJ 1 Reply Last reply
                              0
                              • R Rapidrain

                                @jsulm so when I set a windows environment variable to a value, I am not communicating with the Windows OS in any way??

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #27

                                @Rapidrain It depends on what you mean if you say "Windows OS"? Do you mean Windows NT kernel? Then no, you do not communicate with it. If you consider the shell as part of the OS then you are interacting with the OS, but not communicating as the OS does not care about variables you set - it just sets a variable to a value that's it.

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #28

                                  Hi,

                                  From the image you posted, your jpeg plugin files are not located in the correct sub-folder.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • C Offline
                                    C Offline
                                    Charlie_Hdz
                                    wrote on last edited by
                                    #29

                                    @Rapidrain

                                    Any external image should be allocated in Resources.

                                    Please create a resource file in your project. In the resource view... add a prefix "/", and then insert your image.

                                    In your code, use something like the example below, rather that the absolute path.

                                    m_pBackButton->setIcon(QIcon(":/Resources/cancelButton.jpg"));

                                    Thank you.

                                    Kind Regards,
                                    Enrique Hernandez
                                    gearstech.com.mx
                                    chernandez@gearstech.com.mx

                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      Rapidrain
                                      wrote on last edited by
                                      #30

                                      It's working with jpegs now. I had reference to a non-existant directory in the link statement.
                                      Sorry Charlie, but doing it with this resources dance makes it all too complicated. Doing baby steps here.
                                      Maybe later.

                                      It wasn't the jpeg plugins.

                                      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