[ImageMagick] [sponsor]
Processing
Options
Usage
MagickWand
MagickCore
PerlMagick
Magick++
Unix
Windows
Unix
Mac OS X
Windows
Links

The conjure program gives you the ability to perform custom image processing tasks from a script written in the Magick Scripting Language (MSL). MSL is XML-based and consists of action statements with attributes. Actions include reading an image, processing an image, getting attributes from an image, writing an image, and more. An attribute is a key/value pair that modifies the behavior of an action. See Command Line Processing for advice on how to structure your conjure command or see below for example usages of the command.

Example Usage

We list a few examples of the conjure command here to illustrate its usefulness and ease of use. To get started, here is simple conjure command:

$magick> conjure -dimensions 400x400 incantation.msl

The MSL script incantation.msl used above is here:

  <?xml version="1.0" encoding="UTF-8"?>
  <image size="400x400">
    <read filename="image.gif" />
    <get width="base-width" height="base-height" />
    <resize geometry="%[dimensions]" />
    <get width="width" height="height" />
    <print output="Image sized from %[base-width]x%[base-height] to %[width]x%[height].\n" />
    <write filename="image.png" />
  </image>

In this example, a family stayed home for their vacation but as far as their friends are concerned they went to a beautiful beach in the Caribbean:

  <?xml version="1.0" encoding="UTF-8"?>
  <group>
      <image id="family">
          <read filename="family.gif"/>
          <resize geometry="300x300"/>
      </image>
      <image id="palm-trees">
          <read filename="palm-trees.gif"/>
          <resize geometry="300x100"/>
      </image>
      <image>
          <read filename="beach.jpg"/>
          <composite image="family" geometry="+30+40"/>
          <composite image="palm-trees" geometry="+320+90"/>
      </image>
      <write filename="family-vacation.png"/>
  </group>

Here we display the width in pixels of text for a particular font and pointsize.

  <?xml version="1.0" encoding="UTF-8"?>
  <image>
    <query-font-metrics text="ImageMagick" font="helvetica" pointsize="48" />
    <print output="Text width is %[msl:font-metrics.width] pixels.\n" />
  </image>

The query-font-metrics tag supports these properties:

    msl:font-metrics.pixels_per_em.x
    msl:font-metrics.pixels_per_em.y
    msl:font-metrics.ascent
    msl:font-metrics.descent
    msl:font-metrics.width
    msl:font-metrics.height
    msl:font-metrics.max_advance
    msl:font-metrics.bounds.x1
    msl:font-metrics.bounds.y1
    msl:font-metrics.bounds.x2
    msl:font-metrics.bounds.y2
    msl:font-metrics.origin.x
    msl:font-metrics.origin.y

MSL supports most methods and attributes discussed in the Perl API for ImageMagick.

In addition, MSL supports the swap element with a single indexes element.

You can find additional examples of using conjure in Graphics from the Command Line. Further discussion is available in More Graphics from the Command Line and Examples of ImageMagick Usage.

Option Summary

The conjure command recognizes these options. Click on an option to get more details about how that option works.

Option Description
-debug events display copious debugging information
-help print program options
-log format format of debugging information
-monitor monitor progress
-quiet suppress all warning messages
-regard-warnings pay attention to warning messages.
-seed value seed a new sequence of pseudo-random numbers
-verbose print detailed information about the image
-version print version information