[Image-SIG] question and bug?

Michael A. Miller mmiller3@iupui.edu
07 Dec 2000 11:23:36 -0500

>>>>> "Mike" == Mike Coleman <mcoleman2@kc.rr.com> writes:

    > The latter sounds closer to what I'd like to do (the
    > function is a messy function from X,Y to X0,Y0), but I
    > don't see how to get pixel data in and out 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 one?

Something like this will do it...

import Numeric
import Image

w = 256
h = 256
im = Image.new('P',(w,h))
for i in range(w):
    for j in range(h):
        im.putpixel( (i,j), some_function(i,j) )


Hope that helps, Mike

Michael A. Miller                      mmiller3@iupui.edu
  Krannert Institute of Cardiology, IU School of Medicine
  Indiana Center for Vascular Biology and Medicine