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

Fredrik Lundh fredrik at pythonware.com
Sat Aug 16 09:53:05 CEST 2008

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.


More information about the Python-list mailing list