Nadav
Nadav

Reputation: 157

python PIL Image open isn't RGB

i've been trying to open a .jpg image using

im = Image.open('file.jpg').

my problem is that for some reason the "im" is not an RGB image, i.e the channels are not R,G,B. this also cause the im.convert('L') (rgb2gray) give a very bad result.

channel 0 image, attemped gray sacale.

Im using: Python 2.7.12 |Anaconda 4.1.1 (64-bit)

I would very much appreciate any help figuring this out.

edit: it seems the problem is that the matplotlib color map isn't set right. does anyone know why? and how to fix?

Upvotes: 12

Views: 18278

Answers (1)

homm
homm

Reputation: 2262

You can find current mode in im.mode and do convert with im.convert('RGB').

Upvotes: 13

Related Questions