PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities.
Image.split() method is used to split the image into individual bands. This method returns a tuple of individual image bands from an image.
Splitting an “RGB” image creates three new images each containing a copy of one of the original bands (red, green, blue).
Syntax:
var = Image.Image.split(image_object)
OR
var = Image.Image.split(path_of_image)Return Value: It returns a tuple containing bands.
Code #1:
# importing Image class from PIL packagefrom PIL import Image # opening a multiband image (RGB specifically)im = Image.open(r"C:\Users\Admin\Pictures\network.png") # split() method# this will split the image in individual bands# and return a tupleim1 = Image.Image.split(im) # showing each bandim1[0].show()im1[1].show()im1[2].show() |
Output:
Code #2:
# importing Image class from PIL packagefrom PIL import Image # opening a singleband imageim = Image.open(r"C:\Users\Admin\Pictures\singleband.png") # split() method# this will split the image in individual bands# and return a tuple (of 1 element for singleband)im1 = Image.Image.split(im) # showing imageim1[0].show() |
Output:
Images Used:

