Image attributes

The Image class has a set of attributes common for images. We can use them to print out some of the image’s characteristics, e.g.:

print('Size:', img.size)
print('Format:', img.format)
print('Mode:', img.mode)

The output:

Size: (1200, 1599)
Format: JPEG
Mode: RGB

In the output above you can see that we’ve printed the image size (its width and height), its type (JPEG), and mode (RGB). Here you can find a list of all attributes available.

Geek University 2022