[Numpy-discussion] display numpy array as image

Zachary Pincus zpincus@stanford....
Thu Nov 29 16:32:52 CST 2007

Hello all,

I'm curious if people have experience with / preferences for how to  
display a numpy array onscreen as an image.

Pyglet looks relatively easy -- you can feed an image buffer object  
with a string or a ctypes pointer. I presume getting a string from an  
array is plenty fast, but the ctypes pointer option is intriguing as  
it allows for dealing with simple strided arrays (the image objects  
allow for an arbitrary number of bytes between rows). Is it possible  
to get a ctypes pointer to the beginning of the array buffer from  
numpy without too much ugliness?

wxPython looks pretty easy too, as there are facilities for getting  
pixels from a buffer. Does anyone have any experience with these? Are  
there ways of allowing a numpy array and a wxPython image to point to  
the same memory?

Anyhow, these are specific questions, but I'd also appreciate any  
general thoughts about good approaches for getting pixels from numpy  
arrays onscreen.



More information about the Numpy-discussion mailing list