[Image-SIG] PIL - representing shades of colors in a linear way
Eduardo Ismael
eismb at hotmail.com
Sun Apr 26 22:51:22 CEST 2009
Is it possible to represent all the RGB different colors in a linear way, instead of by a tuple (R, G, B)?
I am asking because I want to delete all shades of blue in an image, like (0, 0, 255) and (51, 0, 255), for example. The problem is that if I set a range using < and >, (see below) it is going to affect other colors in between, like (51, 0, 0), which is far from being blue. here is the code that is not working properly:
for x in range(width):
for y in range(height):
if pixels[x, y] >= (0, 0, 255):
if pixels[x, y] <= (51, 0, 255):
pixels[x, y] = (255, 255, 255)
If I could represent all the shades of a particular color in a linear way, then using < and > would work. Also, the images I am working with were scanned so that's the reason way the pixels don't have an even color. I am open to other solutions as well.
Thanks,
Eduardo
_________________________________________________________________
Messenger 2009: Instale já!
http://download.live.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090426/afb3686f/attachment.htm>
More information about the Image-SIG
mailing list