Image::ValidJpeg - Perl extension for validating JPEG files. |
Image::ValidJpeg - Perl extension for validating JPEG files.
use Image::ValidJpeg;
open $fh, 'FILE.jpg';
if( Image::ValidJpeg::check_jpeg($fh) ) { print "FILE.jpg is bad\n"; }
This module parses JPEG files to look for errors, such as truncated files.
The methods return 0 if the file is valid, nonzero if an error is detected.
This is slightly faster than check_jpeg and should catch most truncated images, unless they happen to be truncated at the end of an embedded JPEG.
This can detect some problems that check_tail cannot, without being noticeably slower, making it useful for scanning a large number of image files.
This it the most thorough method, but also the slowest, so it's useful for checking a small number of images. It's the only one that can differentiate between a bad image and a valid image with extra data appended, or between a valid jpeg and two jpegs concatenated together.
The following contants are defined, to match the return values of the validation functions:
None by default.
The check_* methods and constants can be imported individually, or they call all be imported via the ':all' tag.
Steve Sanbeg
Copyright (C) 2012 by Steve Sanbeg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
Image::ValidJpeg - Perl extension for validating JPEG files. |