[Image-SIG] Information about PythonMagick

Don Rozenberg don.rozenberg at gmail.com
Sun Sep 11 23:52:40 CEST 2005

Fredrik Lundh wrote:
> Don Rozenberg wrote:
>>My interest arises because I want to manipulate the image in ways that
>>are not canned in PIL; I think that I want to get at the pixels to
>>implement my own image transformations.
> slow:
>     value = im.getpixel((x, y))
>     im.putpixel((x, y), value)
> faster:
>     values = im.getdata()
>     im.putdata(values)
> fastest:
>     http://effbot.org/zone/pil-numpy.htm
>     http://effbot.org/imagingbook/imagemath.htm (in 1.1.6)
> (note that Python's not well-suited for writing pixel-by-pixel
> algorithms; the more you can build on existing primitives, the
> faster your program gets.  on the other hand, you can always
> start in pure python, and migrate to C/C++ or Pyrex or Inline
> C when you're done experimenting)
> </F> 
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig


It was my intention to experiment in python and then go to a faster 

Following up your mention of 1.1.6, I downloaded and built 
Imaging-1.1.6a0.tar.gz; however, when I ran 'python selftest.py' I got 
two failures:

Failure in example: im = ImageMath.eval("float(im + 20)", 
from line #116 of selftest.testimage
Exception raised:
Traceback (most recent call last):
   File "./doctest.py", line 499, in _run_examples_inner
     exec compile(source, "<string>", "single") in globs
   File "<string>", line 1, in ?
   File "PIL/ImageMath.py", line 200, in eval
     out =__builtin__.eval(expression, args)
   File "<string>", line 0, in ?
TypeError: __float__ returned non-float (type instance)
Failure in example: im.mode, im.size
from line #117 of selftest.testimage
Expected: ('F', (128, 128))
Got: ('RGB', (128, 128))
1 items had failures:
    2 of  57 in selftest.testimage
***Test Failed*** 2 failures.
*** 2 tests of 57 failed.

I am running python 2.4.1 on a Knoppix/Debian system.  I installed 
python from source. It seems that these failures involve exactly what I 
want to do.  I then tried using python 2.3.5 and '57 tests passed.'. 
Is this a known problem in python 2.4.1?  I guess that I can do my thing 
on the older version of python.

Thanks for your help,

Don Rozenberg
don.rozenberg at gmail.com

More information about the Image-SIG mailing list