/pywand

Python ctypes binding to MagickWand C API of the ImageMagick library

Primary LanguagePythonOtherNOASSERTION

This package is a Python ctypes binding to MagickWand C API of a popular
ImageMagick library ( http://www.imagemagick.org ).

It provides Python interface to call MagickWand API functions
directly. Also it defines lightweight transparent wrappers of
MagickWand's types containing relevant __del__() definition which calls
C API functions to correctly reclaim objects.

Here is a small example of a code that creates an image's thumbnail
(adapted from MagickWand examples on
http://www.imagemagick.org/script/magick-wand.php ):

    from pywand import *

    if __name__ == '__main__':
        wand = NewMagickWand()
        if not MagickReadImage(wand, 'logo.gif'):
            wand.throw_error()

        MagickResetIterator(wand)
        while MagickNextImage(wand):
            MagickResizeImage(wand, 106, 80, LanczosFilter, 1.)

        if not MagickWriteImages(wand, 'logo_thumb.gif', True):
            wand.throw_error()