Use Python Imaging Library to isolate a single channel

python, python-imaging-library

Solution

You can use the `Image.split()` operation from PIL to separate the image into bands:

img = Image.open("image.jpg")
red, green, blue = img.split()

If the image has an alpha channel (RGBA) the split function will aditionaly return that. More information here.

Problem

So say I have an image, and I want to make it so that only the red channel shows up, and the image looks red, how would I do this using PIL? Thanks.

Original source