in reply to ImageInfo errors

To give an example of what Joost said:
#!/usr/bin/perl use warnings; use strict; use LWP::Simple; use Image::Info qw(image_info dim); my $data = get("http://www.learntogoogle.com/images/addform.jpg"); # this will print binary junk #print "$data\n"; my $info = image_info( \$data ); if (my $error = $info->{error}) { die "Can't parse image info: $error\n"; } my($w, $h) = dim($info); print "$w $h\n";

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: ImageInfo errors
by ikegami (Patriarch) on Feb 22, 2007 at 22:38 UTC
    You could save time by just downloading the first 1KB of the image. (IIRC, the location of the image size varies in JPGs, but it's very near the beginning 99.999% of the time.) This can be done using the HTTP Range header field. A sample value would be bytes=0-1023.