ImageMagick: Command-line Tools: Conjure
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems. The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. Choose from these interfaces: MagickCore (C), MagickWand (C), ChMagick (Ch), Magick++ (C++), JMagick (Java), L-Magick (Lisp), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (P [cell cut: 1167 characters, first 1000 kept]
Keywords: command-line, tools:, conjure, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing

Unix
Mac OS X
Windows
Processing
Options
Usage
MagickWand
MagickCore
PerlMagick
Magick++
Unix
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

Discourse Server • Studio