PIL with numpy support!

Charles R Harris charlesr.harris at gmail.com
Tue Oct 10 12:30:12 CDT 2006


On 10/10/06, Charles R Harris <charlesr.harris at gmail.com> wrote:
>
>
>
> On 10/10/06, Christopher Barker <Chris.Barker at noaa.gov> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061010/bffef7cc/attachment-0001.html 
-------------- next part --------------
-------------------------------------------------------------------------
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
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list