PIL Question: Inverse of <image>.load()?

Casey Caseyweb at gmail.com
Sat Aug 16 08:43:14 EDT 2008


On Aug 16, 3:53 am, Fredrik Lundh <fred... at pythonware.com> wrote:
> Casey wrote:
> > I'm doing some image processing that requires accessing the individual
> > pixels of the image.  I'm using PIL 1.1.6 and creating a 2D array of
> > pixel RGB tuples using the Image class instance load() method.
>
> load returns an access object that's attached to the image; to modify
> the image, just assign to the object:
>
>       pix = im.load()
>
>       v = pix[x, y]
>       pix[x, y] = v
>
> to do bulk loads, you can use the getdata/putdata methods instead.
>
> </F>

Ah - I didn't realize from the docs that the results of load() is an
in situ edit to the original buffer.  Thanks!



More information about the Python-list mailing list