Python Pillow: how to produce 3-channel image from 1-channel image?

Viewed 1874

A Python package that I'm trying to use only works with 3-channel images. If I have a grayscale PNG image, Pillow's Image.open() naturally reads it as a single-layer image. How can I use Pillow to transform the 1-channel image into a 3-channel RGB image?

1 Answers

The simplest method to convert a single-channel greyscale image into a 3-channel RGB image with PIL is probably like this:

RGB = Image.open('image.png').convert('RGB')

Further discussion and explanation is available here.

Related