What colour model does the image use in PIL

J

Johny

I use PIL and with it im.getpixel((x,y)) to find out the colour of a
pixel.
But how can I find out in which color model the the return value
is?

For example for png picture format

im.getpixel((20,50)) gives the result 60.

What does the value mean?
Is it possible to find out the RGB model values?

Thank you for help.
L.
 
H

Hrvoje Niksic

Johny said:
I use PIL and with it im.getpixel((x,y)) to find out the colour of a
pixel. But how can I find out in which color model the the return
value is?

im.mode gives you a string such as 'RGBA' or 'CMYK'. im.getbands()
returns a tuple such as ('R', 'G', 'B', 'A').
 
J

Johny

im.mode gives you a string such as 'RGBA' or 'CMYK'. im.getbands()
returns a tuple such as ('R', 'G', 'B', 'A').

Thank you for your help.
Can you please help me once more?
Now I would need to apply a threshold value to the image, where
everything above a certain brightness level becomes white, and
everything below the level becomes black.
How can I do that with PIL?
Thank you
L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top