[Image-SIG] Array to Image transformations
Frédéric Mantegazza
frederic.mantegazza at gbiloba.org
Wed Feb 27 20:42:04 CET 2008
On mercredi 27 février 2008, Christopher Barker wrote:
> Actually, we already have, for numpy and PIL anyway:
>
>
> # 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)
>
> See:
>
> http://effbot.org/zone/pil-changes-116.htm
>
> No data copying at all!
Great! I was using the on-line documentation, which only covers 1.1.5...
I'll have a look at the 1.1.6 doc.
--
Frédéric
http://www.gbiloba.org
More information about the Image-SIG
mailing list