Fetching Image details in Perl

Image::Size is fine, if size is the only thing, which matters. Sometimes, however, it isn’t enough, and when that is the case Image::Info (again fetched from CPAN) is your friend. Point it to a file (through various methods), and it will return a hash with all the information available about the image you pointed at. Most popular formats are supported.

#!/usr/bin/perl -w
use strict;
use Image::Info;

# Just fetch the size
my $imgInfo = Image::Info::image\_info("test.jpg");

# Print out all info fetched from the image
for (keys %$imgInfo) { print " $\_ -> $imgInfo->{$\_}n"; }

exit();