Howto display an array as an image (like imagesc in matlab)

Christopher T King squirrel at WPI.EDU
Thu Jul 29 14:02:30 EDT 2004


On Thu, 29 Jul 2004, Mathias wrote:

> 	- Image.show() which is nice but slow and I don't seem to be
> 	able to either close the window nor draw again to the same
> 	window, so I end up with 100 pictures on the screen...

I'm not too familiar with SciPy, but is this Image class the PIL Image
class?  Because if that's the case, PIL images can be trivially integrated
with Tkinter by using PIL's ImageTk module:

 from Tkinter import Label
 import ImageTk

 mylabel = Label()
 mylabel.pack()

 while True:
     image = process_and_return_image_data_with_scipy()
     label['image'] = ImageTk.PhotoImage(image)

I'm not sure how fast this is though (whether ImageTk.PhotoImage() creates 
a copy of the original image, etc.).




More information about the Python-list mailing list