[Image-SIG] question and bug?

Nick Bower nick@nickbower.com
Thu, 07 Dec 2000 01:57:02 GMT

> of an Image (aside from saving it to a file).  I've read the doc, but =

maybe I
> missed it.  How can I just manipulate pixel values directly, one by on=

as another poster said, you could use numeric python to manipulate=20
individual array elements, then when you're ready and done with all the =

calculations, throw the entire thing into an image.  for a single band=20
image "im":

data =3D resize(array(im.getdata(), typecode=3DInt),(im.size[1],im.size[=

...do stuff to data...

im2 =3D Image.new('L',data.shape[1],data.shape[0])

where data is the 2D array.

If you really want to do it all in PIL on a pixel by pixel basis, from=20
the PIL documentation:

"putpixel putpixel(xy, colour).

Modifies the pixel at the given position. The colour is given as a singl=
numerical value for single-band images, and a tuple for multi-band=20
images. For more extensive changes, use paste or the ImageDraw module=20