Qt World Summit: Register Today!

QImageReader concerns

  • I have a question regarding the QImageReader class.
    I want to get the filename of the images. Let's say the extensions can be anything, not just PNG, JPG, etc... .
    Let's say there are 1000 files in the directory and the size of half of them is over 500 MB.
    I use QImageReader::canRead() function to determine if file is an image or not. How does the QImageReader::canRead() function determine if the file is an image? I don't want to have it load the whole file, then determine if it can recognise it.
    Is it safe to use QImageReader this way?
    Are there any better alternatives?

  • Lifetime Qt Champion


    AFAIK, the canRead function and what's under don't load the file content, it peeks and seeks through to get the information needed but that should be all.

Log in to reply