PIL, and Parts of tuples

Vistro vistro at vistro.net
Mon Apr 13 16:34:18 EDT 2009


I have two problems, and I can't find anything about either of them.
The first is that PIL does not seem to have any way to search each and every
pixel for a value, like

for pixel in img:
    if pixel = ((60, 30), (58, 23), (87 57)):
        # Get out of the for loop
        # Also, save the pixel quardinates to a variable


Then, I also want it to look at a specific pixel (I've got that down), and
do something if the any one of the values in the tuple is out of range.

The issue is, the range is different for every value. Basically, it is to
see if the pixel is in an acceptable color range. So, say, the 60 above can
be anywhere from 58-62, but the 30 needs to be between 28-40.

Is there any way to parse/deal with a value at a specific "slot" in a tuple?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090413/4ea25b71/attachment.html>


More information about the Python-list mailing list