Page 1 of 1

Problem using IM to validate JPEGs

Posted: 2010-07-15T02:52:35-07:00
by kosmarnik
Hi!

I need to validate a bunch (~few million) JPEGs. I;m mostly looking for truncated files, but I'd like the jpeg to be decoded and checked for other possible errors.
I'm on windows so I can't use Image::TestJPG so I decided to give IM a try.
However it doesn't seem to work as I supposed it should.
I get too few errors reported.
My test case has 3 good images, 25 bad ones. IM only reports on 2 of those bad ones, with a 450 error.
I'm using this code:

Code: Select all

 sub testIM {
my $image=Image::Magick->new;
my $file=$_[0];
my $x=$image->Read($file);
$x =~ /(\d+)/;
print $1 if $1; 
}
Any ideas why it's not catching the rest of the errors?