I have a numpy
array with value range from 0-255
. I want to convert it into a 3 channel RGB image. I use the PIL Image.convert()
function, but it converts it to a grayscale image.
I am using Python PIL
library to convert a numpy
array to an image with the following code:
imge_out = Image.fromarray(img_as_np.astype('uint8'))
img_as_img = imge_out.convert("RGB")
The output converts the image into 3 channels, but it's shown as a black and white (grayscale) image. If I use the following code
img_as_img = imge_out.convert("R")
it shows
error conversion from L to R not supported
How do I properly convert numpy arrays to RGB pictures?