View Full Version : check image is valid

11th November 2011, 22:21

How can I fast check is jpg image is valid ?

There is
QImage(strImagePath).isNull() but I'm not sure is this the fastest way to check is image valid...

11th November 2011, 23:28
What do you consider a "valid" image?

11th November 2011, 23:36
sometimes I have question mark in QWebView when jpg file is not fully downloaded in another thread.
thats why I need fast check if jpg file is valid/correct

12th November 2011, 03:15
It still doesn't explain what you mean by "valid". That it has a valid JPEG header or that it contains valid image data? If the former then you can check the file for the header, if the latter then either load the picture and look at it or analyze it and make sure all data is there (i.e. that the file is not truncated).