2. Image getbands


2.1. Getbands

Use the Image.getbands() method to return a tuple containing the name of each band in the image. For example, getbands on an RGB image returns (‘R’, ‘G’, ‘B’).
from PIL import Image

with Image.open("shapes/box.png") as im:
    print(im.getbands())
    # ('R', 'G', 'B', 'A')