By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,399 Members | 886 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,399 IT Pros & Developers. It's quick & easy.

What colour model does the image use in PIL

P: n/a
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.

Nov 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Johny <py****@hope.czwrites:
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').
Nov 7 '07 #2

P: n/a
On Nov 7, 2:53 pm, Hrvoje Niksic <hnik...@xemacs.orgwrote:
Johny <pyt...@hope.czwrites:
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').
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

Nov 7 '07 #3

P: n/a
Johny <py****@hope.czwrites:
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?
I think you're supposed to use the "point" method, but I don't have an
example ready. See
http://mail.python.org/pipermail/ima...er/003019.html
for a hint.
Nov 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.