I am trying to save images in Qt. I am able to save all the formats except jpeg. I have the following libraries under the plugins/imageformats folder.
libqgif.so,
You might find what the problem is by:
Setting the environment variable QT_DEBUG_PLUGINS
to 1 before running your application.
It will print the plugin loading attempts/successes/failures on the console.
Using a QImageWriter to get a more explicit error message than with just QImage::save
or QPixmap::save
:
QImageWriter writer("/tmp/test.jpg");
if(!writer.write(pixmap.toImage()))
{
qDebug() << writer.errorString();
}
Under windows the qjpeg4.dll
must in a imageformats
directory under the application's directory by default.
Try adding the following line to your main:
QApplication::addLibraryPath( <path to directory containing libjpeg.so> );
Check if the linking in the .so files are proper.