##
#!/usr/bin/perl -w
use strict;
use Image::Size;
($x, $y) = imgsize("path/to/yourfile.jpg");
####
sub sizeJPG {
return unless $_[0];
my ($width, $height);
($height,$width) = unpack( "nn", $1 ) if $_[0] =~ /\xFF\xC0...(....)/;
return ($width,$height);
}