# Multichannel numpy array to PIL image

I have a 4 channel Numpy image that needs to be converted to PIL image in order implement torchvision transformations on image. But when I try to do this using PIL.Image.from_array(<my_numpy_image>) I get the following error.

TypeError: Cannot handle this data type

I cannot loose and get rid of any channel information right now so won't be able to discard any channels.

• Are you sure you are passing in a Numpy array of floats? Can you print type(my_numpy_image) and my_numpy_image.dtype? Aug 21 '19 at 17:39
• It's numpy array of np.uint8 Aug 21 '19 at 17:43

img = Image.fromarray(source_array, mode="CMYK")