How to validate image?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
thardy

How to validate image?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to validate image?

Post by magick »

The command
  • identify *.tif
is the most efficient method to validate whether an image is corrupt or not.
thardy

Re: How to validate image?

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to validate image?

Post by magick »

All functions of the command line is available from MagickWand, MagickCore, or PerlMagick. Try MagickWand and use MagickIdentifyWand().
Post Reply