TkMagick

Main | TclMagick | TkMagick |  |

## TkMagick - glue between TclMagick and Tk's Images

TkMagick is a small, simple extension that lets you pass images back and forth between Tk and the TclMagick extension.

It has only two commands:

- magicktophoto magick_wand tk_image
  This command takes a pre-existing magick wand and tk photo image and replaces the tk image's data with the magick wand's data.
- phototomagick tk_image magick_wand
  This command takes a pre-existing tk photo image and magick wand as arguments, and replaces the magick wand's image with that contained in the tk image.

### Example:

          proc magickimage {filename} {
            set magimg [magick create wand]
            set tkimg [image create photo]
            $magimg ReadImage $filename
            magicktophoto $magimg $tkimg
            magick delete $magimg
            return $tkimg
          }

          set poolphoto [magickimage [file join $dirname .. images pool.jpg]]
          label .im
          .im configure -image $poolphoto
          pack .im
          bind . <q> exit

Copyright 2004 Rolf Schrödter and David N. Welton