Image.shape from PIL code example Example: PIL image shape from PIL import Image im = Image.open('whatever.png') width, height = im.size