Important: Please read the Qt Code of Conduct -

[Solved] JPEG support in Qt 4.8.1 / QtCreator 2.4.1 (Linux 64bit)

  • After installing the latest SDK 1.2 it seems a couple of things no longer work; JPEG support is gone and then there's "this":

    I would prefer not to have to recompile my Qt as most Qt JPEG support Google hits seem to suggest; and I most certainly did not have to do so with an earlier SDK. Wonder if it would be time to downgrade.

    Oh and I'm running Ubuntu 12.04 with libjpeg8 / ia32-libs installed.

    • M

    PS: Installing the standalone QtCreator 2.5.0 takes care of the installation issue, but no JPEG support on the latest SDK? :o

  • JPEG support is certainly present in my SDK:
    @$ ls Desktop/Qt/4.8.1/gcc/plugins/imageformats/

    I don't know what your bug has to do with JPEG support.

  • Yeah I've noticed too, that my plotting library suddenly can't export jpegs anymore. That's not so dramatic since who wants to export pixel precise plots as jpeg, but still, Qt promises JPG/JPEG is available ("By default, Qt can write the following formats":, and it isn't.

    I get the same imageformats directory output as ChrisW67:
    ~/QtSDK/Desktop/Qt/4.8.1/gcc/plugins/imageformats$ ls

    Yet the code
    @qDebug() << "Writer:" << QImageWriter::supportedImageFormats() << "\n";
    qDebug() << "Reader:" << QImageReader::supportedImageFormats();@

    @Writer: ("BW", "EPS", "EPSF", "EPSI", "PCX", "RGB", "RGBA", "SGI", "TGA", "bmp", "bw", "eps", "epsf", "epsi", "ico", "jp2", "pcx", "pic", "png", "ppm", "rgb", "rgba", "sgi", "tif", "tiff", "xbm", "xpm", "xv")

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

    JPEG/JPG nowhere to be found, and writing jpegs fails as expected from that output.

  • @
    Writer: ("BW", "EPS", "EPSF", "EPSI", "PCX", "RGB", "RGBA", "SGI", "TGA", "bmp", "bw", "eps", "epsf", "epsi", "ico", "jpeg", "jpg", "pcx", "pic", "png", "ppm", "rgb", "rgba", "sgi", "tga", "tif", "tiff", "xbm", "xpm", "xv")

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

    This is on Gentoo BTW.

    It looks like the cannot find your system JPEG libraries and does not load as a result. Does:
    ldd ~/QtSDK/Desktop/Qt/4.8.1/gcc/plugins/imageformats/

    in the environment from which you are running your test program identify the missing library?

  • Thanks ChrisW67.
    ldd said that is missing, so I installed it manually (sudo apt-get install libjpeg62) which fixed the issue.

    Now I'm just wondering why they did that, made plugins/imageformats/ depend on version 62 and not 8, as is present on my system... Maybe it has always been depending on 62, but ubuntu 12.04 threw it out in favour of 8.

  • You are using a pre-built binary, and it has to be built against a particular version of the library API. The major version number change from libjpeg 6 to 8 indicates that the API is not compatible so the operating system will not match the program and the wrong version of the library. This is the UNIX solution to the equivalent of Windows DLL hell (and signifcantly simpler then SxS assemblies and the manifest file).

  • Oh.. heh yeah missing libjpeg62 was my issue as well. Damned :p

    Using JPEG textures is rather essential in a mobile app since they load way faster and as the Qt resources are built into the binary, makes app load way faster.. so I wanted to be able to continue to use JPEGs on the development desktop environment as well.

    Good call about checking that with ldd.

    • M

Log in to reply