Problem using IM to validate JPEGs

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
kosmarnik
Posts: 4
Joined: 2010-07-15T02:42:46-07:00
Authentication code: 8675308

Problem using IM to validate JPEGs

Post 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?
Post Reply