Get Width and Height of Image using Python

Pillow library

  1. Install Pillow library from the command line:
pip install Pillow
  1. Get width and height of an image:
from PIL import Image

img = Image.open('test.jpg')
width, height = img.size

print(str(width) + ' ' + str(height))

Leave a Comment

Cancel reply

Your email address will not be published.