Image::Magick::Info - Retreive image attributes with Image::Magick.
use Image::Magick::Info qw( get_info ); my $info = get_info("/users/aroth/Desktop/photo.jpg", ("filesize","width","height") ); my $info = get_info( $FILE_HANDLE, ("filesize") ); my $info = get_info( \*FILE, ("width","height") );
This module is a thin wrapper over ImageMagick's getAttribute() function. There are faster modules out there (which don't rely on ImageMagick) that you may want to check out (see 'SEE ALSO').
get_info( filename|filehandle, attributes )
'filename' is the path of the source image (or a filehandle).
'attributes' is a list of attributes you wish to retreive.
A comprehensive list of all possible attributes can be found here at http://imagemagick.org/script/perl-magick.php#get_attributes. Some of the more common are:
filesize width height format mime
get_info() returns a hashref of the image attributes. Example:
$VAR1 = { 'height' => 98, 'colors' => 2568, 'filesize' => 17159, 'width' => 101 };
get_info( filename, array_of_attributes )
Image::Size
Image::Info
Image::Magick::Thumbnail::Fixed
Image::Magick::Brand
Adam Roth, <aroth@cpan.org>
Copyright 2005 by Adam Roth
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Image::Magick::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Magick::Info
CPAN shell
perl -MCPAN -e shell install Image::Magick::Info
For more information on module installation, please visit the detailed CPAN module installation guide.