[Qt-interest] QImageReader cannot detect image format

Guido Seifert Wargand at gmx.de
Thu May 6 09:00:46 CEST 2010


Hi,
I have here a very strange problem. I try to detect the format of an image using "QByteArray imageFormat(const QString &fileName)". All I get is an empty array. Ok, according to docs: 

If supported, this function returns the image format of the file fileName. Otherwise, an empty string is returned.

So far so good, so this method can fail. I tried with gifs, pngs, jpegs. When I load them into a QImage, they display just fine. I also used the non-static methods and played with QImageReader::autoDetectImageFormat() and QImageReader::decideFormatFromContent(). Regardless what I do,
 
QImageReader::supportsOption(QImageIOHandler::ImageFormat) returns false.

What on earth could I do wrong? I mean, if really nothing  else works, at least detection by file extension should work. I just don't believe that detecting such common formats could be a problem.

I am working on Linux with Qt-4.6.0.

Regards,
Guido


-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the Qt-interest-old mailing list