Page 1 of 1

How do I judge a file's type?

Posted: 2008-01-22T20:01:01-07:00
by soulmachine
Magick::Image test1("test.txt");//will crash when running
Magick::Image test2;
test2.read("test.txt");//will also crash

I notise that read(std::string& imgSpec) does not return a value,so I cannot control my program to ignore files which are not images.

Is there any way to known a file's type, or just tell me whether a file is a image?
thanks :)

Re: How do I judge a file's type?

Posted: 2008-01-22T20:09:38-07:00
by magick
We tried your code and it returned an exception as expected. We're using ImageMagick 6.3.8-0.