Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get image mode PIL Python

I am trying to blend two images together but I keep getting an error that one of the images in in the wrong mode. I tried to convert this image but every mode I have tried just makes the entire image white. Is there a way in Python with the PIL module to find out what the current image mode is?

Image.blend(img ,im ,0.05)

Error message: ValueError: image has wrong mode

like image 367
Chidwack Avatar asked Nov 20 '15 16:11

Chidwack


1 Answers

See the Image Attributes in the documentation:

Image.mode: str

Image mode. This is a string specifying the pixel format used by the image. Typical values are '1', 'L', 'RGB', or 'CMYK'. See Modes for a full list.

The Image.convert method creates, from an existing image, a new Image with a given mode.

like image 190
Peter Wood Avatar answered Nov 02 '22 18:11

Peter Wood