[Numpy-discussion] display numpy array as image

Joshua Lippai discerptor at gmail.com
Thu Nov 29 18:13:58 EST 2007


On Nov 29, 2007 2:32 PM, Zachary Pincus <zpincus at stanford.edu> wrote:
> 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.
>
> Thanks,
>
> Zach
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

Have you tried the matplotlib/pylab module? It has pretty simple ways
of doing what you're thinking of if I'm understanding your intent
correctly..

Josh



More information about the NumPy-Discussion mailing list