How to get the size of an image in Python – Programming Code Examples
Python

How to get the size of an image in Python1 min read

Getting the size of an image with the Python Image Library (PIL) returns its width and height in pixels.

USE Image.Image.size TO RETURN THE SIZE OF AN IMAGE




Call Image.open(fp) to open an image with the filename fp. Use PIL.Image.Image.size with this opened image to return a tuple containing the width and height in pixels.

Python Code:

Python Code(Alternative):

Output:

To show image use show() method

Leave a Comment