TclMagick: A Tcl interface to ImageMagick


Version 0.2: July 2003 (alpha)

TclMagick is a  Tcl-extension for to access the ImageMagick C-API with simple Tcl-commands.
With TclMagick it's easy to automate image manipulation.

TclMagick knows three types of objects: wand, drawing, pixel. For each object a Tcl command of the same name is created (analog to Tcl's image command). The subcommands of those object commands are mainly a one-to-one mapping of the corresponding ImageMagick's Wand API functions. For a detailed description of the separate functions see the Wand API documentation.

A list of the supported functions and a complete change log can be found here: TclMagick.txtChanges.txt

Note:

ImageMagick's new high-level Wand API is still under development and will be stable at the end of 2003. Therefore TclMagick may need an update with every new ImageMagick version.

Bug reports and comments:
Any comments, suggestions and bug reports for TclMagick are welcome. If you are sure that you found a bug in ImageMagick than you may report it directly to the ImageMagick MagickWand board.

Sample code:

# Load the tclMagick module
#
load TclMagick.dll

# Create wand & draw objects
#
set wand [magick create wand]
set draw [magick create draw]

# Load & enlarge a PNG
#
$wand ReadImage sample.png
$wand ResizeImage 500 500 cubic

# Draw a red "Tcl/Tk" rotated by 45°
#
$draw push graph
    $draw SetStrokeWidth 1
    $draw SetStrokeColorString "red"
    $draw SetFillColorString "red"
    $draw SetFontSize 18
    $draw Annotation -97 170 "Tcl/Tk"
$draw pop graph
$draw Rotate -45

$wand DrawImage $draw

# Write the image in different file formats
#
$wand WriteImage sample.jpg
$wand WriteImage sample.gif
$wand WriteImage sample.pdf

# Delete wand & draw objects
#
magick delete $draw
magick delete $wand

Download source:  TclMagick-Source-5.5.8a2.zip
Source incl. compiled Windows-DLL: TclMagick-Windows-Bin-5.5.8a2.zip
Image magick Windows binary: ImageMagick-5.5.8-noX11-Q16-windows-dll.exe (~4.1 MBytes), needs ghostscript (fonts): gs706w32.exe (5.2 MByte)


Contact:  Rolf.Schroedter@dlr.de