[PYTHON IMAGE-SIG] PIL Feature Summary

Fredrik Lundh fredrik_lundh@ivab.se
Thu, 30 May 1996 10:22:49 +0200


> I've using the PIL and I got a problen whit split method, to solve
> it, I had  to add, in Image.py in the split method, load and
> rage. like this.

Thanks.  I'll add this fix to 0.1b2.

> By the way, How can I manipulate the pixels indivuduality like a
> unisgned char or int?. I've worked with _tostring method and the array
> object but, it manipulates a signed integers.

I plan to add a getpixel() method in 0.1b2, which would at least allow
you to implement eyedropper tools and such.

If you need performance, you should be able to use numerical extension
which includes an enhanced array object (see the matrix-sig FAQ at
<http://www.python.org/sigs/matrix-sig> for details).  A rudimentary
interface is attached.

Regards	/F

--------------------------------------------------------------------

import Image, Numeric

def ImageToArray(i):
    a = Numeric.array(i._tostring(), "b")
    a.shape = i.size[1], i.size[0]
    return a

def ArrayToImage(a):
    i = Image.new("L", (a.shape[1], a.shape[0]))
    i._fromstring(a.toString())
    return i

# "If you cannot do it in 8 lines of Python, it is probably
#  not worth doing."

=================
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
=================