From: Charles R H. <cha...@gm...> - 2006-10-10 17:30:17
|
On 10/10/06, Charles R Harris <cha...@gm...> wrote: > > > > On 10/10/06, Christopher Barker <Chr...@no...> wrote: > > > > Hi all: > > > > Fredrik Lundh wrote: > > > A little later that planned, but PIL 1.1.6 beta 2 is now available > > from SVN: > > > > > > http://svn.effbot.python-hosting.com/tags/pil-1.1.6b2/ > > > > > > A tarball will appear on effbot.org shortly: > > > > > > http://effbot.org/downloads/#Imaging > > > > > > As usual, PIL 1.1.6 supports all Python versions from 1.5.2 and > > onwards, > > > including 2.5. > > > > > > For a hopefully complete list of changes, see: > > > > > > http://effbot.org/zone/pil-changes-116.htm > > > > From there: > > > > """ > > * Added "fromarray" function, which takes an object implementing the > > NumPy array interface and creates a PIL Image from it. (from Travis > > Oliphant). > > > > * Added NumPy array interface support (__array_interface__) to the Image > > class (based on code by Travis Oliphant). This allows you to easily > > convert between PIL image memories and NumPy arrays: > > import numpy, Image > > > > i = Image.open('lena.jpg') > > a = numpy.asarray(i) # a is readonly > > i = Image.fromarray(a) > > """ > > > Fromarray wasn't there for me running latest PIL from svn last week. I had > to use another function whose name escapes me at the moment (I don't use PIL > very often), but yes, there is a way to use numpy arrays in PIL. > Ah, I recall now, I used Image.frombuffer(...) or some such. This is probably a problem if the numpy array is not of the right type. Chuck |