The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Validate::Image - Validates an image and returns basic info

IMPORTANT

REQUIRES convert (from imagemagick) to be installed and in the path for animated gif/frame detection

I used convert over PerlMagick because I found PerlMagick to be very unstable.

SYNOPSIS

use Data::Validate::Image;

my $validator = Data::Validate::Image->new();
my $image_info = $validator->validate( '/path/to/image' );

if ( defined( $image_info ) ){
    #valid image, do things here
} else {
    #invalid image
}

DESCRIPTION

pretty simple image validator class. returns hash of image properties on success,

undef for invalid images

hash properties are

'width' => image width,
'height' => image height,
'size' => image filesize (KB),
'mime' => image mime type,
'file_ext' => *correct* file extenstion,
'frames' => frame count, #requires convert from imagemagic to be installed
'animated' => 1 || 0, #requires convert from imagemagic to be installed

METHODS

validate

returns image info or undef for invalid image

SUPPORT

Bugs should always be submitted via the CPAN bug tracker

For other issues, contact the maintainer

AUTHORS

n0body <n0body@thisaintnews.com>

SEE ALSO

http://thisaintnews.com, Image::Info

LICENSE

Copyright (C) 2012 by n0body http://thisaintnews.com/

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.