Contents:
PythonMagickWand - Version 0.2dev (c) 2007 - Achim Domma - domma@procoders.net http://www.procoders.net
I still get a lot requests to update PythonMagick, which is based on boost.python and is too hard to maintain. So I decided to develop a ctypes based wrapper for the MagickWand API, which should be enough to do common image manipulation tasks in python.
This is a very early alpha version which is not tested very well and will find the ImageMagick library only on a Mac OS X with macports installed. But for the time beeing it should be easy to adjust the path to the dll for your system.
Please don’t ask questions about how to use the API! I’m not an ImageMagick expert. Usually I need ImageMagick to do simple things like resizing of images. You will find mailinglists about ImageMagick on http://www.imagemagick.org. The documentation of the MagickWand API can be found on http://www.imagemagick.org/script/magick-wand.php.
The package is licensed under the MIT license.
Any feedback is very welcome!
Achim
If you import the PythonMagickWand module, it tries to load the ImageMagick library, which is probably not found on your system. If you get the error message ‘Could not load ImageMagick library’ you have to set the environment variable MAGICK_WAND_LIB to point the library on your system. After that, the following import should work:
>>> from PythonMagickWand import *
Now we are ready to create a new wand
>>> wand = NewMagickWand()
and to load an image from a file.
>>> MagickReadImage(wand,"sample.jpg") #doctest: +ELLIPSIS
<MagickBooleanType object at ...>
Let’s resize the image
>>> MagickScaleImage(wand,200,200) #doctest: +ELLIPSIS
<MagickBooleanType object at ...>
and save it to a new file.
>>> MagickWriteImage(wand,"out.png") #doctest: +ELLIPSIS
<MagickBooleanType object at ...>
>>>