user3603644
user3603644

Reputation: 125

Loading in python png image made in gimp as rgb image

I created my own image in gimp made out of two layers. Mode was set as follows: Image->mode->rgb. Than I saved that as png.

Afterwards, I tried to load this image in python script using PIL.Image. But unfortunately, what was loaded was image with four numbers for every pixel, so I guess, it was loaded as CMYK. Is there any way to restrict that the image will be loaded as rgb, or, is there any way how to really force the convertor to save it as rgb?

Thanks, Tomas.

Upvotes: 0

Views: 480

Answers (1)

a5kin
a5kin

Reputation: 1435

What you get is not CMYK, but RGBA value, since PNG supports alpha channel. To get 3-value RGB for each pixel try:

im = Image.open('test.png').convert('RGB')

Upvotes: 2

Related Questions