- Get image width and height without downloading in PYTHON
- import cStringIO
- import urllib
- import Image
- file = urllib.urlopen('http://static.php.net/www.php.net/images/php.gif')
- im = cStringIO.StringIO(file.read())
- img = Image.open(im)
- print img.format, img.size, img.mode
- GIF (120, 67) P
- width, height = img.size
- print width, height