Page 1 of 1

How to check if image can be read

Posted: 2010-12-06T02:48:13-07:00
by Senos
Hello Wonderful ImageMagick World :)

Is there any Magick++ method that reads image from a location (C:/images/test.jpg) and returns bool if the image is found ?

I have an if statement and I would like to know if the image can be read before I proceed.

Re: How to check if image can be read

Posted: 2010-12-06T20:45:52-07:00
by anthony
Add -regard-warnings and check the status result of your image processing.

In a script this is typically to read the image into a temporary file while also extracting basic information such as image width and height.

Re: How to check if image can be read

Posted: 2010-12-07T11:21:11-07:00
by Senos
How can such a thing implemented in c++ ?
I thought that was for command line only

Thanks for your kind reply

Re: How to check if image can be read

Posted: 2010-12-07T17:09:56-07:00
by anthony
In C++ and other API's you should be checking the error returned from the image read process and act accordingly!