Getting the dimensions of a remote image file without having to save it to the hard drive

Posted by kaloyan on Stack Overflow See other posts from Stack Overflow or by kaloyan
Published on 2010-04-19T07:57:13Z Indexed on 2010/04/19 8:03 UTC
Read the original article Hit count: 276

Filed under:

I am looking for a way to get the dimensions of a remote image file without having to save it to the hard drive -- I am trying to skimp on the I/O requests. Basically something like PHP's getimagesize() function.

I did try something like this:

print Image.open(urllib2.urlopen(src)).size

but PIL wants a file handle that has a seek() method.

Any ideas?

© Stack Overflow or respective owner

Related posts about python