Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage unable to open jpg files
Qt 6.12 LTS is out! See what's new in the release blog

QImage unable to open jpg files

Scheduled Pinned Locked Moved General and Desktop
20 Posts 3 Posters 11.2k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #8

    You might be using two different versions of the jpeg library. The one used by OpenCV and the one for the jpeg plugin in Qt.

    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
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #9

      @mchinand Yes, I can see the images from webcam. I use to shows in a widget with the class QViewfinder.
      To save file I use the functions provide by QCameraImageCapture.
      Moreover I show the captured frame in a QLabel widget by QPixmap and from this I saved with QFile.
      But the same problem.
      If I save in PNG or TIFF no problem.

      @SGaist I think you are right, but I don't know how to say to Qt to use the same of OpenCV.
      I could use OpenCV to capture the image from webcam, the problem is that OpenCV let me to do with a fix resolution. So, to try to overcome a problem I face another one.

      Regards

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

        Did you build either for them ?

        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
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #11

          @SGaist
          OpenCV was already built in the software pack supplied with Jetson Tk1.
          The version is made in order to get the best performance from the Jetson board.
          Later I built Qt and Qt Creator.
          I follow the instructions I found in Qt wiki and I added the suggested library (Building from git).
          But I have not so deep knowledge to understand if there was something connected with jpeg library.

          Regards.

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

            Check with ldd where the libjpeg used by OpenCV is located. If it's the system lib then you can add -system-libjpeg to your configure options.

            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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #13

              You might also want to check with Qt 5.5.1 there was a bug in 5.5.0 see this bug report

              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
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #14

                @SGaist Thank you for your advices.
                I am workig on them. I will inform you as soon as I have some results.

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #15

                  @SGaist
                  I am back again.
                  Before to build with the new 5.5.1 I reset the Jetson TK1 with the new release of Jetson Pack (Before I had 1.1 now 1.2).
                  I download from Qt git the version 5.5.1 and I compiled without problem.
                  Then I download from git the version 3.6 of QtCreator and compiled wtihout problem (to compile correctly I had to modify something in 3rd party Botan as I found in nVidia forum).
                  When I run Qt Creator I have a problem in the configuration of Buil & Run.
                  I can configure the GCC Compiler but in the Kit the Compiler doesn't show any option.

                  MZ

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #16

                    @SGaist

                    About QtCreator: I can use the version that I get form Ubutnu repository (3.0.1) and I can configure the Kit without problem.

                    About jpeg: I still have problem. Now I cannot read the image from webcam.

                    MZ

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

                      Are you sure you are building using the system libjpeg ?

                      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
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #18

                        With the version 5.5.0 the option didin't work. There was an error.
                        Now I try again with 5.5.1 and I have an error again.
                        Here the steps i did:

                        • download source from git;
                        • init-repository ( I use the option --no-webkit but it looks it doesn't work because I get also webkit);
                        • checkout 5.5.1;
                        • removed manually webkits/webengine (deleted forlders);
                        • ./configure -qtxcb -system-libjpeg -nomake examples -nomake tests;
                        • make: with -system-libjpeg I have an error
                          ../../../gui/image/qjpeghandler.cpp:64:21: fatal error: jpeglib.h: No such file or directory

                        MZ

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

                          Did you install the system libjpeg dev package ?

                          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
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #20

                            You are right, I forgot to install it.
                            I did and rebuild.
                            But still the same error:
                            JPEG parameter struct mismatch: library thinks size is 432, caller expect 488.

                            In the past I looked for examples of use of Qt + OpenCV and if possible developed on Jetson TK1.
                            I found some example of Qt + OpenCV and one project developed on Jetson TK1 with only OpenCV.
                            All don't use Qt (QCamera) to grab pictures (while they use all the other features of Qt, even QThread) but directly OpenCV.
                            The one developed with Jetson TK1 has developed a tool based directly on V4L2, to have more flexibility in the control of the camera.
                            These examples work.

                            MZ

                            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
                            • Unsolved