Qt- unable to save jpeg files
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 folde开发者_JS百科r.
libqgif.so, libqjpeg.so.
Do I have to place them in a different folder to make this work? Is there any new libraries that I have to install to make this work. I work on linux platform and my application is supported on all linux platforms. So do I have to install separate libraries for each platform?
Thanks,
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 justQImage::save
orQPixmap::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.
精彩评论