Page 1 of 1

How to validate image?

Posted: 2007-03-30T10:09:10-07:00
by thardy
What's the quickest way to validate an image using ImageMagick? In particular, we have a ton of TIFF images we need to validate (we know some are corrupt).

ImageMagick throws an exception when we try to convert these to GIF, but the library chews on the image for a long time (8+ seconds) before throwing the exception. We need a faster way to simply identify if an image is corrupt or not.

Any help will be appreciated.

Re: How to validate image?

Posted: 2007-03-30T10:40:42-07:00
by magick
The command
  • identify *.tif
is the most efficient method to validate whether an image is corrupt or not.

Re: How to validate image?

Posted: 2007-03-30T14:08:41-07:00
by thardy
That works great! Thanks. Now, can I call that programmatically? I have a few million images I need to check, and I would prefer to call this functionality from a program, instead of spawning a separate process for each file.

Is the identify functionality available in a core library I can get an API to?

Re: How to validate image?

Posted: 2007-03-30T16:04:25-07:00
by magick
All functions of the command line is available from MagickWand, MagickCore, or PerlMagick. Try MagickWand and use MagickIdentifyWand().