[Image-SIG] PIL - representing shades of colors in a linear way
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.
Messenger 2009: Instale já!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Image-SIG