Get the size (dimension) of an image
You want to get the size (dimension) of an image.
We will use the Pillow package here, which is the successor of PIL.
from PIL import Image # uses pillow image_file = "something.jpg" im = Image.open(image_file) print im.size # return value is a tuple, ex.: (1200, 800)
If the image is on the web and you don’t want to download it, you can get the size of the image in bytes (see this post and get ‘Content-Length’).