[Image-SIG] Quicker image transfer, tobuffer?

Christopher Barker Chris.Barker at noaa.gov
Tue Jul 11 02:09:41 CEST 2006

Pete Shinners wrote:
> It looks like the Pygame will soon be wanting quicker methods for sharing image
> data than the traditional tostring/fromstring. Both PIL and Pygame now have a
> "frombuffer" command, which speeds up this transaction by avoiding one of the
> two copies of pixel data.

This is crying out to be a use for the new "array interface" proposed 
(and used) by numpy:


Essentially, the idea is similar to a buffer, but with more information 
carried along with it. Rather than an arbitrary array of bytes, the 
interface provides a pointer to the data, and also information about the 
size, layout and type of the data.

The goal of the numpy team is to get this integrated into the python 
standard library, so that any package that deals with arrays of data can 
communicate easily with other such packages.

There are a lot of folks already transferring data back and forth 
between numpy arrays, PIL images, PyGame, OpenGL, wxPython, etc. It 
would be a really great thing to get a few more packages sharing the 
same protocol.

Please join the numpy team in this, it will really benefit the Python 
community to have one way of exchanging this kind of data.


Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Image-SIG mailing list