[Image-SIG] Information about PythonMagick

Fredrik Lundh fredrik at pythonware.com
Sun Sep 11 11:37:47 CEST 2005


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> 





More information about the Image-SIG mailing list