(python2.7)
$ pip install pillow
#!/usr/bin/env python # coding=utf-8 from PIL import Image from cStringIO import StringIO from urllib import urlopen def get_image_size(url): file = StringIO(urlopen(url).read()) img = Image.open(file) return (img.width, img.height) if __name__ == '__main__': url = 'https://www.google.co.jp/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' width, height = get_image_size(url) print('width: {}, height: {}'.format(width, height))