A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/347709.html below:

help for conversion of NUMARRAY to PIL object

help for conversion of NUMARRAY to PIL objectRobert Kern rkern at ucsd.edu
Thu Sep 15 11:06:15 EDT 2005
A. L. wrote:
> hi, everybody here,
> 
>     I am a newbie to python. I encounter a problem that how to convert
> an array of numarray to pil object. For example, the data in an image
> is extracted using Image.getdata, then the data are converted into  an
> array in numarray. But when the array is needed to convert to the pil
> object, I lose my mind. Could somebody here provide some solutions to
> this problem?  (In other words, all I need is the interface between
> reading/writing image data and NUMARRAY.)

In [11]: from numarray import *

In [12]: import Image

In [13]: a = zeros((256,256, 4), UInt8)

In [14]: img = Image.frombuffer('RGBA', (256,256), a)

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4