8. Image getpixel


8.1. Getpixel

Use the Image.getpixel(xy) method to the pixel value at a given position given as (x, y).
If the image is a multi-layer image, this method returns a tuple.
from PIL import Image

with Image.open("shapes/box.png") as im:
    print(im.getpixel((32, 32)))
    # (255, 127, 39, 255)