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 load JPEGs not working - Qt4.6.3, QtCreator2.0, Ubuntu 9.8
Qt 6.12 LTS is out! See what's new in the release blog

QImage load JPEGs not working - Qt4.6.3, QtCreator2.0, Ubuntu 9.8

Scheduled Pinned Locked Moved General and Desktop
17 Posts 7 Posters 41.0k Views 1 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.
  • E Offline
    E Offline
    erapid
    wrote on last edited by
    #2

    Are there any ... error messages in Application console log? Can you check?

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

      Do you mean the Application Output window? If so there is one error there:

      &"Warning: GDB: Failed to set controlling terminal: Invalid argument \n"

      1 Reply Last reply
      0
      • E Offline
        E Offline
        erapid
        wrote on last edited by
        #4

        Yep. Hmmm...

        As I recall, the QT library, by default, building with "-system-libjpeg". I.e. "Use libjpeg from the operating system". Perhaps you have no jpeg library.

        Please, put in your code
        qDebug() << QImageReader::supportedImageFormats ();
        and check Application output

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

          Application output is:

          ("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

          How can I add jpg support?

          Thank you.

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

            I tried to install the latest version of libjpeg-dev and I get a message that I already have the latest version:

            user1@user1-desktop:~$ sudo apt-get install libjpeg-dev
            Reading package lists... Done
            Building dependency tree
            Reading state information... Done
            Note, selecting libjpeg62-dev instead of libjpeg-dev
            libjpeg62-dev is already the newest version.
            The following packages were automatically installed and are no longer required:
            linux-headers-2.6.31-14 linux-headers-2.6.31-14-generic
            Use 'apt-get autoremove' to remove them.
            0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              erapid
              wrote on last edited by
              #7

              This is a good question :)

              1. How did U install Qt?
              2. As far as I understood, any case, qt uses its own plugin to work with jpeg. But building configuration may deny to build plugin, for example, it is key "-no-jpeg". Perhaps, QT didn't find jpeg library...
                On my pc, qt image plugins are in
                /usr/lib/qt4/plugins/imageformats
                There are
                libqgif.so libqico.so libqjpeg.so libqmng.so libqsvg.so libqtiff.so

              Where is TROLL to explain this situation :)

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

                I installed Qt via the latest download(Open Source Qt 4.6.3 & Qt Creator 2.0) from qt.nokia.com.

                I checked my usr/lib/qt4/plugins/imageformats location and it has the same plugins you mentioned.

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

                  set the environment variable QT_DEBUG_PLUGINS, e.g.

                  export QT_DEBUG_PLUGINS=1

                  then run your app. Check the debug output for errors.

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

                    I've also got the same problem.

                    If it makes any difference I've built a number of different versions of qt from 4.5 to 4.6.3 and it has never worked for me. I compile Qt using visual studio 2005 in Windows 7. Although I could download the built libraries from the website I need sqlite support and as such I need to recompile.

                    Following the previous post I've found this errors between a lot more making references to other image plugins.

                    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/32bitVSSQL/qt/plugins/imageformats/libqjpeg4.a"
                    "The file 'C:/Qt/32bitVSSQL/qt/plugins/imageformats/libqjpeg4.a' is not a valid Qt plugin."
                    not a plugin

                    and then

                    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/32bitVSSQL/qt/plugins/imageformats/qjpeg4.dll"
                    In C:/Qt/32bitVSSQL/qt/plugins/imageformats/qjpeg4.dll:
                    Plugin uses incompatible Qt library
                    expected build key "Windows msvc debug full-config", got "Windows mingw release full-config"
                    "The plugin 'C:/Qt/32bitVSSQL/qt/plugins/imageformats/qjpeg4.dll' uses incompatible Qt library. Expected build key "Windows msvc debug full-config", got "Windows mingw release full-config""
                    not a plugin

                    Does anybody have some idea? That's something that has been bugging me for a long time.

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

                      MinGW and MSVC have different ABIs, you can't load plugins generated with one compiler into an app generated with the other compiler.

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

                        Well, that's why I recompiled qt from visual studio. Shouldn't the standard configuration compile also the image formats plugins?

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

                          bq. Well, that’s why I recompiled qt from visual studio. Shouldn’t the standard configuration compile also the image formats plugins?

                          That depends on you configuration, make sure Qt was configured with JPEG support. Could it be that you tried building with MSVC in the same directory where you already had a MINGW build, and for some reason, JPEG was disabled in your build? That'll leave stale plugins, which won't load in your newly built Qt.

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

                            I'm getting the same problem on Ubuntu 10.04. QtCreator 4.7.1
                            Here are details.
                            http://www.windyweather.net/wp/2011/03/03/qt-4-7-on-ubuntu-lucid-not-loading-jpg-image-plugin/

                            Program sources are available, of course.
                            Works fine on a system where the tools are installed. On a target system without Qt SDK, libqtcore4 and libqtgui4 packages are installed. Plugins are where the program expects them to be, but only the PNG images work, not JPG images. [haven't checked other formats.]

                            Build system is x86 and target system is x64 if that matters.
                            Details contains screen shots of plugin folders, lib paths and supported image formats.

                            it says JPG is supported, but program will not load JPG images.

                            Is this a bug between x86 and x64 systems?
                            Using x86 build and x64 target works fine on Windows system, but plugins are manually moved in that case rather than using package install.
                            I'm trying to figure out how to package this program for Deb/Ubuntu systems and I have to get it to work first on system without SDK installed.

                            Do we know what I missed, or is this a bug?

                            Thanks,
                            Windy

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              luca
                              wrote on last edited by
                              #15

                              Same problem with SDK 1.1.4 .

                              I'm trying this code:
                              @
                              QImage image;
                              qDebug() << QImageReader::supportedImageFormats ();
                              image.load("/home/luca/immagini_vscam/T0-20111122-223411510.jpg");
                              qDebug() << image.height();
                              @

                              but while running I get a "segmentation fault".

                              The supported formats are:
                              @
                              ("BW", "EPS", "EPSF", "EPSI", "EXR", "PCX", "PSD", "RAS", "RGB", "RGBA", "SGI", "TGA", "XCF", "bmp", "bw", "dds", "eps", "epsf", "epsi", "exr", "gif", "ico", "jp2", "jpeg", "jpg", "mng", "pbm", "pcx", "pgm", "pic", "png", "ppm", "psd", "ras", "rgb", "rgba", "sgi", "svg", "svgz", "tga", "xbm", "xcf", "xpm", "xv")
                              @

                              I have libjpeg 8 installed in my system and my application is linked to it:
                              @
                              ldd my_app
                              linux-gate.so.1 => (0xffffe000)
                              ...
                              ...
                              libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0xb4991000)
                              libpng14.so.14 => /usr/lib/libpng14.so.14 (0xb496a000)
                              libtiff.so.3 => /usr/lib/libtiff.so.3 (0xb4910000)
                              ...
                              ...
                              libphonon.so.4 => /home/luca/QtSDK/Desktop/Qt/474/gcc/lib/libphonon.so.4 (0xb2f78000)
                              libQtDBus.so.4 => /home/luca/QtSDK/Desktop/Qt/474/gcc/lib/libQtDBus.so.4 (0xb2ef0000)
                              libQtXml.so.4 => /home/luca/QtSDK/Desktop/Qt/474/gcc/lib/libQtXml.so.4 (0xb2ea5000)
                              @

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                luca
                                wrote on last edited by
                                #16

                                I solved by compiling from source the Qt 4.7.4 libraries.

                                Now I can use jpeg without problem.

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

                                  Hi everyone!
                                  Maybe it would be useful. Problem may be in path to image. Just by adding ":" a got my image to display. E.g.: "images/pic.jpg" -> ":images/pic.jpg".

                                  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