PDA

View Full Version : [mac] QImage.load fails



snoopy67
6th November 2007, 11:56
In my little app, i have the following code:



QImage b;
if ( ! b.load(fileName) ) {
cerr << "Could not load image: " << qPrintable(fileName) << endl;
}


This works just fine under Windows and Linux, but i can't get it to work under Mac OS X (10.4.10).
I am using Qt 4.3.1

The filename and its permissions are OK.

I have also checked the path of the image formats plugins with this code:


QStringList paths = QCoreApplication::libraryPaths();
for ( QStringList::Iterator p = paths.begin(); p != paths.end(); ++ p )
printf( "%s:", (*p).toLatin1().constData() );

This path seems to be OK, too.

Does anyone have an idea why QImage does not load the image?

Can I get more info why it does not load the image?

Any pointers, hints, suggestions, etc., will be highly appreciated.

Best regards,
Gabriel.

DeepDiver
6th November 2007, 13:37
Just a rough guess: do you have the necessary image plugin available on Mac?

snoopy67
6th November 2007, 22:26
I think so:

% ll /usr/local/qt/plugins/imageformats/
-rwxr-xr-x 1 root wheel 46K Aug 28 12:20 libqgif.dylib*
-rwxr-xr-x 1 root wheel 558K Aug 28 12:20 libqgif_debug.dylib*
-rwxr-xr-x 1 root wheel 167K Aug 28 12:20 libqjpeg.dylib*
-rwxr-xr-x 1 root wheel 1M Aug 28 12:20 libqjpeg_debug.dylib*
-rwxr-xr-x 1 root wheel 345K Aug 28 12:20 libqmng.dylib*
-rwxr-xr-x 1 root wheel 1M Aug 28 12:20 libqmng_debug.dylib*
-rwxr-xr-x 1 root wheel 41K Aug 28 12:20 libqsvg.dylib*
-rwxr-xr-x 1 root wheel 557K Aug 28 12:20 libqsvg_debug.dylib*
-rwxr-xr-x 1 root wheel 331K Aug 28 12:20 libqtiff.dylib*
-rwxr-xr-x 1 root wheel 1M Aug 28 12:20 libqtiff_debug.dylib*

jpn
6th November 2007, 22:41
What does QImageReader::supportedImageFormats() return?

snoopy67
7th November 2007, 15:06
Thanks a lot!

I have found this list of image formats:
bmp , pbm , pgm , png , ppm , xbm , xpm

Which I got with this code:



QList<QByteArray> formats = QImageReader::supportedImageFormats();
for ( QList<QByteArray>::Iterator f = formats.begin(); f != formats.end(); ++ f )
printf("%s , ", f->constData() );


First of all, I am really supprised, because from QCoreApplication::libraryPaths() I've ot this path: /usr/local/qt-4.3.1/plugins
And there is the sub-directory imageformats, and in that there is libqjpeg.dylib .
So why is that?

Second, the question, of course is, what can I do?

Best regards,
Gabriel.