[Image-SIG] How to create a new RGB image from an mxnx3 numpy array
ned at nedbatchelder.com
Sat Oct 4 16:59:32 CEST 2008
I use code like this:
pixels = numpy.zeros((200, 300, 3), dtype=numpy.uint8)
//.. write data into the pixels array ..
im = Image.fromarray(pixels)
David Goldsmith wrote:
> Hi! I've been over and over the handbook, tried everything I could think of, and still can't figure it out: how the heck does one get an m x n x 3 numpy array interpreted as an RGB image? I tried fromarray, both with the whole array, and trying to merge the three images resulting from fromarray-ing the three m x n sub-arrays, creating the image first and then using putdata in various ways, etc., etc. Please help. Thanks.
> PS: Also, more discussion of the Palette concept in the handbook would be nice (e.g., what's its relation, if any, to the concept of colormaps, as used, e.g., in matlab and matplotlib). Thanks again.
> Image-SIG maillist - Image-SIG at python.org
Ned Batchelder, http://nedbatchelder.com
More information about the Image-SIG