Easy PIL question

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Feb 16 21:15:10 CET 2008

Gary Herron:
> Try image.getpixel((x,y)) to retrieve the pixel at (x,y).

If the OP needs to access many pixels, then he can use the load()
method on the image object, and then read/write pixels (tuples of 3
ints) using getitem []

import Image
im = Image....
img = im.load()
img[x,y] = ...
... = img[x,y]

I don't know why the image object itself can't have the __getitem__/


More information about the Python-list mailing list