PIL Question: Inverse of <image>.load()?
Caseyweb at gmail.com
Sat Aug 16 14:43:14 CEST 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.
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