[Image-SIG] Converting from numarray to PIL

Dylan Moreland dylan.moreland at gmail.com
Sun Jun 12 23:44:12 CEST 2005


Hello all,

I'm working with some large numarrays of astronomical data (1000 by
1000 pixels) that I want to quickly transform into grayscale images
for use in my wxPython app. I've tried drawing them using canvas
methods in both PIL and wx, scaling the values from their original
range to [0, 255] for use as the colors, but this is too slow for my
application. I see from

http://effbot.org/zone/pil-numpy.htm

That it is possible to directly transform a numarray into an Image,
but there isn't much documentation about the typecodes involved. How
would I transform my array into one that, when loaded into PIL,
displays a range of grays?

Thanks!

Dylan Moreland
University of Michigan


More information about the Image-SIG mailing list