Can’t Save JPEG in a Deployed Qt Application

This has been haunting me for quite some time. When building Qt app for Windows, the QImage::save() function did not work for JPEG for deployed applications, while it did work if Qt SDK was installed on the machine.

As per docs, you just need to copy qjpeg4.dll into imageformats folder within the folder where the app’s .exe resides.

The problem was, that I just used the very first qjpeg4.dll file I could put my hands on, presuming they’re all the same.

Well, it appears there are several different versions of this file within the Qt SDK installation, and the one you really need is located in Desktop/Qt/4.x.y/mingw/plugins/imageformats. Take the qjpeg4.dll file located there, and copy it into imageformats folder inside the deployed folder, and all should be swell.

Note: If you’re deploying a debug build, copy the qjpeg4d.dll file instead.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s