PIL with numpy support!

Christopher Barker Chris.Barker at noaa.gov
Tue Oct 10 11:59:53 CDT 2006

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 

* 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)

I hope some of us numpy users will be able to test this new 
functionality while it's in beta.


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

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash

More information about the Numpy-discussion mailing list