Image sizes in Perl
If you need for figure out the size of an image, fetch Image::Size from CPAN , it’s just what you need. The module recognizes the most common image-formats such as JPG, GIF, PNG, PSD, TIFF and plenty more. The interface is simple and will get you what you need with no trouble at all.
#!/usr/bin/perl -w use strict; use Image::Size; # Just fetch the size my ($size_x, $size_y) = Image::Size::imgsize('test.jpg'); print "Image is: $size_y x $size_x (height x width)\n"; # HTML-friendly format my $size = Image::Size::html_imgsize('test.jpg'); exit();