The easiest way to do it would probably be by using
LWP::Simple (see 'get') and
Image::Size (using 'imgsize'):
#!/usr/bin/perl -w
use Image::Size;
use LWP::Simple;
use Carp;
use strict;
{
my $loc = "http://perlmonks.org/images/usermonkpics/httptech.gif";
my $img = get $loc or croak "Can't get $loc!";
# when the argument passed to imgsize
# is a reference (as opposed to a
# simple scalar), it assumes it's
# pointing to an in-memory buffer,
# instead of to a filename.
my ($width, $height) = imgsize(\$img);
print "Width: $width\n", "Height: $height\n";
}
[ ar0n ]