What: TclMagick Where: http://tclmagick.sourceforge.net/ Description: Tcl only interface to ImageMagick library. Will make use of ImageMagick's Wand-API. Provides a one to one mapping of the Wand API - requires no Tk to do image manipulation. Currently in beta state. Updated: 08/2003 Contact: See web site ---- [LV] any feeling for when tclmagick and tkmagick will be stable enough for a formal release? 2004/11/18 [sheila] I love these extensions and I hope a formal release comes soon. The few crashes and build problems I had were solved very quickly after I asked the developers for help. Sheila, did you get a successful build of Tkmagick for windows? If so could you mail me the .dll or post it somewhere? Thanks [RT] [sheila] Yes, I did. Let me see about making it available and/or the VC++ project files. What type of build problems did you have? [RT] Got it compiled and linked but the result crashed when a command was invoked (This more than a few months ago). Perhaps it was mislinked. I did build TclMagick OK after modifying its project file. I would be like to get both the .dll and the "make" file if you can share. ---- [Rolf Schroedter] provides this example of the extension: # Load the tclMagick module # load TclMagick.dll # Create wand & draw objects # set wand [magick::wand create] set draw [magick::draw create] # 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::draw delete $draw magick::wand delete $wand ---- This extension is tracking an unstable version of ImageMagick (CVS, basically). I have an updated version for the latest out of CVS that now also compiles on Linux. Hopefully, TclMagick will be included in ImageMagick itself at some point. - [davidw] ---- [davidw]: I am working on making code that will link the Tcl imagemagick code with Tk. Although of course you do not and should not need Tk to use the TclMagick extension! You don't need a display to process images. ... For now it's just going to be a command to transfer preexisting Tk images to preexisting ImageMagick "wand"'s, and vice versa. In the future, I'd like to allow for tighter integration ala Img. ---- [elfring] 2003-12-01 Would you like to get a [canvas] to work with the [Wand API] [http://www.imagemagick.org/www/api.html]? ---- The TkMagick extension is also built with TclMagick, and you can use it to transfer Magick images to Tk images. ---- [ES]: This looks very useful, but I can't get the code! The suggested anonymous CVS command on the home page returns the following: cvs -d:pserver:anonymous@cvs.graphicsmagick.org:/GraphicsMagick co TclMagick cvs checkout: warning: failed to open /home/edsuom/.cvspass for reading: No such file or directory cvs checkout: authorization failed: server cvs.graphicsmagick.org rejected access to /GraphicsMagick for user anonymous cvs checkout: used empty password; try "cvs login" with a real password ---- [davidw]: Oops, requires you to first run 'login' with password anonymous. The web page is updated now in any case, and I will remove these comments in a week or so. ---- 2004/11/18 [sheila] I've been learning TclMagick and TkMagick, and I figured I'd share some of my fumblings here in case it helps anyone else. The documentation is spare, and I'd like to perhaps make some pages for all of the commands if that is okay for this wiki. One of the first puzzlers was cropping behavior. The ImageMagick documentation that I found says that a crop will keep the part of the picture in the crop, preserving its location on the canvas, but this is not what I found when I attempted to try this on my own. http://www.cit.gu.edu.au/~anthony/graphics/imagick6/crop/#crop Notice that the size of the displayed image has not been effected by the "-crop" operation. The actual image itself has been cropped, but the canvas on which the GIF image is displayed is still the same size as the original canvas. Though the position of the cropped image matches that of the original image. Here's an ascii rendition of what I saw and what I expected. beginning image +----------------+ | image | | +----+ | | |crop| | | | | | | +----+ | | | +----------------+ cropped section +----+ |crop| unexpected canvas | | +----+ Overlay operation unexpected behavior expected behavior +----+ ----------+ +----------------+ |crop| | | image2 | | | | | +----+ | +----+ | | |crop| | | image2 | | | | | | | | +----+ | | | | | +----------------+ +----------------+ Here is a simple .tcl file I made to play around with this. package require Tk package require TclMagick package require TkMagick proc test_crop {} { set red_wand [magick create wand] set yellow_wand [magick create wand] $red_wand ReadImage red.png $yellow_wand ReadImage yellow.png # select arbitrary crop dimensions set width [expr [$yellow_wand width] - 100] set height [expr [$yellow_wand height] - 100] # crop a section away from the origin $yellow_wand crop $width $height 50 50 # overlay the cropped result onto the red wand $red_wand composite $yellow_wand over # change to photo set composite_photo [image create photo] magicktophoto $red_wand $composite_photo # draw on canvas canvas .c .c create image 0 0 -image $composite_photo -anchor nw -tag crop grid .c } proc clean_magick {} { # free all of the magick objects foreach mobj [magick names] { magick delete $mobj } } console show (launch and type test_crop to see the unexpected behavior) 2004/10/19 [sheila] correction: I received a reply from the TclMagick mailing list explaining that the documentation I read is based on the command line interface for ImageMagic, and TclMagick is based on the C API for ImageMagick. The functionality is not quiet the same. This was an interesting exploration for me. To get what I want, I will play around with compositions. ...off to work! (I dumped my png files into http://feafaroth.org/png/yellow.png and http://feafaroth.org/png/red.png) ---- [Category Package] | [Category Graphics]