Run ImageMagick MSL Scripts Safely with conjure
By the end of this guide you will have run a Magick Scripting Language (MSL) file with ImageMagick's conjure, passed an image setting from the shell, and checked the result without guessing which executable is installed. Allow about 10 minutes if ImageMagick is already present.
The route
Jump straight to the step you need, or tick off Done means at the end.
Before you start
You need ImageMagick 6 and a shell account with a writable working directory. This guide uses ordinary user privileges. Do not use sudo: the example creates output in your own directory and does not need a system change.
conjure, conjure-im6 and conjure-im6.q16 are aliases for the command on this installation. The versioned name makes the ImageMagick 6 Q16 build explicit, while the shorter name is easier to put in a script.
1. Check the executable and version
Run the version check before troubleshooting a script. It confirms both that the command is on your PATH and which ImageMagick build will interpret the file.
command -v conjure
conjure -version
On the machine used for this guide, the result includes ImageMagick 6.9.12-98 Q16 x86_64. The installed Debian package is imagemagick-6.q16 8:6.9.12.98+dfsg1-5.2ubuntu0.1~esm13. Your package revision may differ even when the ImageMagick version is the same.
Checkpoint
The command prints version information and exits successfully. If command -v prints nothing, install or enable the package that provides ImageMagick 6 before continuing.
2. Create a small MSL workflow
MSL is XML-based. A script normally reads an image, applies one or more actions, and writes a result. The input and output names below are deliberately obvious placeholders; replace them with files you own.
<?xml version="1.0" encoding="UTF-8"?>
<image>
<read filename="input.png" />
<resize geometry="800x800" />
<write filename="output.png" />
</image>
Save that as resize.msl beside input.png. The resize geometry uses ImageMagick's usual maximum-dimensions form, so a large image is reduced to fit within 800 by 800 pixels while retaining its aspect ratio.
There is one typo trap worth catching before execution: keep both quotes around the geometry value and close the empty element with />. A malformed attribute can make the whole XML file unreadable.
Keeping the script in a separate file makes it easier to review and rerun. It also means the shell command stays short.
3. Run the script and verify the output
From the directory containing the two input files, run the versioned executable:
conjure-im6.q16 resize.msl
A successful run normally produces no progress text. Check the file rather than treating a quiet terminal as proof:
identify output.png
Expected output contains the filename, an image format such as PNG, and dimensions no larger than 800 by 800. The exact dimensions depend on the source image.
Checkpoint
output.png exists and identify can read it. If the output file already existed, the script may have replaced it. Restore it from your backup or recreate it from the original input if that was unintended.
4. Pass settings from the command line
The manpage permits image settings and other key/value pairs before the script name. This is useful when the same script needs a different canvas or colour without editing XML. For example:
conjure-im6.q16 -size 100x100 -color blue resize.msl
Settings can affect how the script interprets later actions. Keep them close to the command that uses them, and record unusual values in the script's documentation. Options such as -verbose print detailed image information; -monitor reports progress; -quiet suppresses warnings.
For diagnostics, start with -verbose or use -debug events when you need much more detail:
conjure-im6.q16 -verbose resize.msl
conjure-im6.q16 -debug events resize.msl
Do not leave -quiet in a production wrapper until you have decided how warnings will be detected. If warnings should affect your handling, add -regard-warnings and test the exit status in the surrounding shell script.
Safety and common failures
Read an MSL file before running it, especially one downloaded from elsewhere. It can read image paths and write output paths, and image processing can consume substantial memory, disk space or CPU. Run unfamiliar scripts in a disposable directory with non-sensitive files. Never grant elevated privileges just to make an image workflow run.
The error No such file usually means the script's relative path is being resolved from the current directory, not from the directory where the MSL file was found. Use absolute paths temporarily while diagnosing, or change into the intended working directory first.
If the command prints a warning but creates output, inspect the warning rather than hiding it. -quiet is a display option, not a repair. If the XML is rejected, check its closing tags and attribute quotes first, then rerun with -verbose.
When a workflow overwrites a valuable image, stop and recover the original from your backup. There is no general undo command for a file that has already been replaced.
Done means
conjure -versionidentifies the intended ImageMagick build.- Your MSL file has been reviewed and points only at intended input and output paths.
conjure-im6.q16 resize.mslcompletes without an error.identify output.pngconfirms a readable result with the expected dimensions.