Magick 0.2

Travis E. Oliphant oliphant@ieee.org
Tue, 08 Apr 2003 16:42:02 -0600


I am announcing the release of a Python Interface to Image Magick
http://www.imagemagick.org

ImageMagick is a very powerful image library that also contains a very 
powerful drawing API reminiscient of display PDF.  It provides support 
for reading and writing a very impressive number of image formats, 
including a few movie formats.

Download version 0.2 at http://www.sourceforge.net/projects/pylab

There is a currently another Python interface to ImageMagick based on 
the Boost system.  This interface uses a more traditional approach to 
wrap the ImageMagick C-library.  It can be installed with a simple

python setup.py install

As long as you have the ImageMagick library installed in a standard 
place this should work.  Theoretically it should work (with some minor 
modifications to the setup.py script) on Windows as well because 
ImageMagick DLL's can be obtained for Windows.  But, I have not tested this.

The interface is well-tested with an 8-bit Quantum for ImageMagick 
(though it should work for higher Quantum depths, too).

Two objects are available in the module:

an MImage object which is the ImageMagick image list.
an DrawInfo object which is a drawing context for drawing in 
ImageMagick's graphic language.

Example:

 >>> import magick
 >>> im = magick.image('file1.jpg', 'file2.png', 'file3.tiff')

This will load a sequence of images which you can manipulate like a 
list. If you have X-windows

 >>> im[0].display()

should display the first image in the sequence.

Images can be constructed quite easily from Numeric Arrays as well.

im = magick.image(a)

will construct an image if a is a 2-D to a 4-D array.  RGB(A) images are 
   MxNx3(4) Numeric arrays,  grayscale images are MxN arrays.  Sequences 
of images can be created this way by pre-pending a dimension to the front.
Palette images can be created by passing in a tuple of arrays, where the 
first array is a grayscale image and the second array gives the palette).

Support for most of ImageMagick is already included.  Properties for the 
image magick structure can be obtained and set.

Support for ImageMagick's drawing API is also available through the
im.draw(obj)  command

obj is either a string containing the primitives to draw, a drawinfo 
object (which has some properties set plus a string of commands to 
draw), or an object with a __primitives__ method which returns the 
string to draw.

Full affine transformations are available in the API and rotated text is 
handled quite well.

Documentation is quite sparse still, but most commands are the same as 
those documented on the ImageMagick site.

API calls that return new images are called as magick.XXXX

API calls that modify an image in place are called as im.XXXX  where im 
is Magick Image.

The interface is quite usable right now, despite the low release number, 
so if you've heard of imagemagick and want to give it a try, now is a 
good time to do it from the Python interpreter.

Comments always welcome.

-Travis Oliphant
oliphant.travis@ieee.org