in reply to corrupt image

Try Image::Magick Ping.
my ($width,$height,$size,$format) = $image->Ping("myimage.gif") or die + "FAIL";
added: Also, just saw PerlMagick that read() returns error code 325 for Corrupt image.