Python: get size of image using PIL or Pillow
examples/python/pil_get_image_size.py
from PIL import Image import sys in_file = sys.argv[1] img = Image.open(in_file) print(img.size) print(img.size[0]) print(img.size[1])
size returns a tuple of (width, height) of the image.
Published on 2019-04-22
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post