<?xml version="1.0"?>
<!--
  Delegate command file.

  Commands which specify

    decode="in_format" encode="out_format"

  specify the rules for converting from in_format to out_format
  These rules may be used to translate directly between formats.

  Commands which specify only

    decode="in_format"

  specify the rules for converting from in_format to some format that
  GraphicsMagick will automatically recognize. These rules are used to
  decode formats.

  Commands which specify only

   encode="out_format"

  specify the rules for an "encoder" which may accept any input format.

  For delegates other than gs-color, gs-mono, and mpeg-encode
  the substitution rules are as follows:

    %i  input image filename
    %o  output image filename
    %u  unique temporary filename
    %z  secondary unique temporary filename

    %#  input image signature
    %b  image file size
    %c  input image comment
    %d  original filename directory part
    %e  original filename extension part
    %f  original filename
    %t  original filename top (base) part
    %g  window group
    %h  image rows (height)
    %k  input image number colors
    %l  input image label
    %m  input image format ("magick")
    %n  input image number of scenes
    %p  page number
    %q  input image depth
    %r  input image storage class, colorspace, and matte
    %s  scene number
    %w  image columns (width)
    %x  input image x resolution
    %y  input image y resolution
    %[  input image attribute (e.g. "%[EXIF:Orientation]")
    %%  pass through literal %

  Under Unix, all text (non-numeric) substitutions should be
  surrounded with double quotes for the purpose of security, and
  because any double quotes occuring within the substituted text will
  be escaped using a backslash.

  Commands (excluding file names) containing one or more of the
  special characters ";&|><" (requiring that multiple processes be
  executed) are executed via the Unix shell with text substitutions
  carefully excaped to avoid possible compromise.  Otherwise, commands
  are executed directly without use of the Unix shell.

  Use 'gm convert -list delegates' to verify how the contents of this
  file has been parsed.

 -->
<delegatemap>
  <delegate decode="autotrace" stealth="True" command='"@AutotraceDecodeDelegate@" -output-format svg -output-file "%o" "%i"' />
  <delegate decode="browse" stealth="True" command='"@BrowseDelegate@" "http://www.GraphicsMagick.org/" &'  />
  <delegate decode="cgm" command='"@CGMDecodeDelegate@" -d ps < "%i" > "%o" 2>/dev/null' />
  <delegate decode="dcraw" command='"@DCRAWDecodeDelegate@" -c -w "%i" > "%o"' />
  <delegate decode="dot" command='"@DOTDecodeDelegate@" -Tps "%i" -o "%o"' />
  <delegate decode="dvi" command='"@DVIDecodeDelegate@" -q -o "%o" "%i"' />
  <delegate decode="edit" stealth="True" command='"@EditorDelegate@" -title "Edit Image Comment" -e vi "%o"' />
  <delegate decode="emf" command='"@WMFDecodeDelegate@" -o "%o" "%i"' />
  <delegate decode="eps" encode="pdf" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSPDFDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <delegate decode="eps" encode="ps" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSPSDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <delegate decode="fig" command='"@FIGDecodeDelegate@" -L ps "%i" "%o"' />
  <delegate decode="gplt" command='"@EchoDelegate@" "set size 1.25,0.62; set terminal postscript portrait color solid; set output "%o"; load "%i"" > "%u"; "@GnuplotDecodeDelegate@" "%u"' />

  <!-- Read monochrome Postscript, EPS, and PDF  -->
  <delegate decode="gs-mono" stealth="True" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSMonoDevice@ -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s "-sOutputFile=%s" -- "%s" -c quit' />

  <!-- Read grayscale Postscript, EPS, and PDF  -->
  <delegate decode="gs-gray" stealth="True" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSGrayDevice@ -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s "-sOutputFile=%s" -- "%s" -c quit' />

  <!-- Read color Postscript, EPS, and PDF  -->
  <delegate decode="gs-color" stealth="True" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSColorDevice@ -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s "-sOutputFile=%s" -- "%s" -c quit' />

  <!-- Read color+alpha Postscript, EPS, and PDF  -->
  <delegate decode="gs-color+alpha" stealth="True" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSColorAlphaDevice@ -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s "-sOutputFile=%s" -- "%s" -c quit' />

  <delegate decode="hpg" command='"@HPGLDecodeDelegate@" -q -m eps -f `basename "%o"` "%i" && mv -f `basename "%o"` "%o"' />
  <delegate decode="hpgl" command='"@HPGLDecodeDelegate@" -q -m eps -f `basename "%o"` "%i" && mv -f `basename "%o"` "%o"' />
  <!-- Read HTML file  -->
  <delegate decode="htm" command='"@HTMLDecodeDelegate@" -U -o "%o" "%i"' />
  <!-- Read HTML file  -->
  <delegate decode="html" command='"@HTMLDecodeDelegate@" -U -o "%o" "%i"' />
  <delegate decode="ilbm" command='"@ILBMDecodeDelegate@" "%i" > "%o"' />
  <!-- Read UNIX manual page  -->
  <delegate decode="man" command='"@MANDelegate@" -man -Tps "%i" > "%o"' />
  <!-- Read MPEG file using mpeg2decode  -->
  <delegate decode="mpeg" command='"@MPEGDecodeDelegate@" -q -b "%i" -f -o3 "%u%%05d"; @GMDelegate@ convert -temporary "%u*.ppm" "miff:%o" ; rm -f "%u"*.ppm ' />
  <!-- Write MPEG file using mpeg2encode -->
  <delegate encode="mpeg-encode" stealth="True" command='"@MPEGEncodeDelegate@" "%i" "%o"' />
  <!-- Convert PDF to Encapsulated Poscript using Ghostscript -->
  <delegate decode="pdf" encode="eps" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSEPSDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <!-- Convert PDF to Postcript using Ghostscript -->
  <delegate decode="pdf" encode="ps" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSPSDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <!-- Convert PNM file to ILBM format using ppmtoilbm -->
  <delegate decode="pnm" encode="ilbm" mode="encode" command='"@ILBMEncodeDelegate@" -24if "%i" > "%o"' />
  <delegate decode="pnm" encode="launch" mode="encode" command='"@LaunchDelegate@" "%i"' />
  <delegate decode="pnm" encode="win" mode="encode" command='"@GMDelegate@" display -immutable "%i"' />
  <!-- Read Persistance Of Vision file using povray  -->
  <delegate decode="pov" command='@POVDelegate@ "+i"%i"" +o"%o" +fn%q +w%w +h%h +a -q9 -kfi"%s" -kff"%n"
    "@GMDelegate@" convert -adjoin "%o*.png" "%o"' />
  <delegate decode="ps" encode="eps" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSEPSDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <delegate decode="ps" encode="pdf" mode="bi" command='"@PSDelegate@" -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSPDFDevice@ "-sOutputFile=%o" -- "%i" -c quit' />
  <delegate decode="ps" encode="print" mode="encode" command='"@PrintDelegate@" "%i"' />
  <!-- Read Radiance file using ra_ppm -->
  <delegate decode="rad" command='"@RADDecodeDelegate@" -g 1.0 "%i" "%o"' />
  <!-- Convert RGBA file to URT RLE using rawtorle -->
  <delegate decode="rgba" encode="rle" mode="encode" command='"@GMDelegate@" mogrify -flip -size %wx%h "rgba:%i"
    "@RLEEncodeDelegate@" -w %w -h %h -n 4 -o "%o" "%i"' />
   <!-- Scan an image using Sane's scanimage -->
  <delegate decode="scan" command='"@SCANDecodeDelegate@" -d "%i" > "%o"' />
  <!-- Read HTML file  -->
  <delegate decode="shtml" command='"@HTMLDecodeDelegate@" -U -o "%o" "%i"' />
  <!-- Convert ASCII text to Postscript using 'enscript' command -->
  <delegate decode="txt" encode="ps" mode="bi" command='"@TXTDelegate@" -o "%o" "%i"' />
  <!-- Render WMF file using wmf2eps (fallback in case libwmf not available) -->
  <delegate decode="wmf" command='"@WMFDecodeDelegate@" -o "%o" "%i"' />
  <delegate encode="show" stealth="True" command='"@GMDelegate@" display -immutable -delay 0 -window_group %g -title "%l of %f" "tmp:%o" &' />
</delegatemap>
