[IMAGE-SIG] fun with Numeric and PIL

David Konerding dek@cgl.ucsf.EDU
Sat, 05 Jul 97 23:13:30 -0700

I heard Numeric would work with PIL, so I tried it.  Seems to work fine.

I'm looking into playing around with FFTs on images; anybody done this
and have sample code (using Numeric/PIL)?

Here's a nifty little test program to demonstrate PIL + Numeric:
## This isn't really a PyOpenGL demo, but it's a nice
## example of how Numeric, Tkinter, and PIL can be used 
## together to create all sorts of images.
## see http://picasso.ucsf.edu/~dek/PyOpenGLDemo

import Numeric
import FFT
import Tkinter
import Image
import ImageTk
import sys

w = 256
h = 256

if __name__ == '__main__':
    data = Numeric.arrayrange(w*h)
    data = data.astype('l')

    im = Image.new("RGBA", (w, h))
    print len(data.tostring())
    print len(im.tostring())

    root = Tkinter.Tk()
    image = ImageTk.PhotoImage(im)
    x = Tkinter.Label(root, image=image)


Email: dek@cgl.ucsf.edu   David Konerding   WWW: http://picasso.ucsf.edu/~dek

IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org