HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: //var/chroot/usr/share/doc/ImageMagick-7/www/fx.html



<!doctype html>
<html lang="en" data-bs-theme="auto">
<head>
  <script src="assets/color-modes.js" ></script>
  <meta charset="utf-8"  />
  <meta name="viewport" content="width=device-width, initial-scale=1"  />
  <title>ImageMagick – The FX Special Effects Image Operator</title>
  <meta name="keywords" content="the, fx, special, effects, image, operator, ImageMagick, image processing, command-line tool, format conversion, photo editing" />
  <meta name="description" content="The FX Special Effects Image Operator" />
  <meta name="application-name" content="ImageMagick" />
  <meta name="application-url" content="https://imagemagick.org" />
  <meta name="copyright" content="Copyright (c) 1999 ImageMagick Studio LLC" />
  <meta itemprop='url' content='../' />
  <meta itemprop='title' content='ImageMagick' />
  <meta itemprop='description' content="ImageMagick is a free and open-source software suite used for editing and manipulating digital images. It provides a versatile set of tools for various image-related tasks. You can use ImageMagick to resize, convert, and apply various transformations to images. It supports a wide range of file formats, including JPEG, PNG, GIF, TIFF, and Ultra HDR." />
  <meta property='og:url' content='../' />
  <meta property='og:name' content='ImageMagick' />
  <meta property='og:image' content='../images/logo.png' />
  <meta property='og:type' content='website' />
  <meta property='og:site_name' content='ImageMagick' />
  <meta property='og:description' content="ImageMagick is a free and open-source software suite used for editing and manipulating digital images. It provides a versatile set of tools for various image-related tasks. You can use ImageMagick to resize, convert, and apply various transformations to images. It supports a wide range of file formats, including JPEG, PNG, GIF, TIFF, and Ultra HDR." />
  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
  <link type="images/png" sizes="64x64" href="../images/wand.png" rel="icon" />
  <link type="images/icon" sizes="16x16" href="../images/wand.ico" rel="shortcut icon" />
  <link href="fx.html" rel="canonical" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3" />
  <link href="assets/magick.css" rel="stylesheet" />
  <script async src="https://localhost/pagead/js/adsbygoogle.js?client=ca-pub-3129977114552745" crossorigin="anonymous"></script>
</head>
<body>
  <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
    <symbol id="check2" viewBox="0 0 16 16">
      <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
    </symbol>
    <symbol id="circle-half" viewBox="0 0 16 16">
      <path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
    </symbol>
    <symbol id="moon-stars-fill" viewBox="0 0 16 16">
      <path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"/>
      <path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z"/>
    </symbol>
    <symbol id="sun-fill" viewBox="0 0 16 16">
      <path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/>
    </symbol>
  </svg>
  <div class="dropdown position-fixed bottom-0 end-0 mb-3 me-3 bd-mode-toggle">
    <button class="btn btn-bd-secondary py-2 dropdown-toggle d-flex align-items-center"
            id="bd-theme"
            type="button"
            aria-expanded="false"
            data-bs-toggle="dropdown"
            aria-label="Toggle theme (auto)">
      <svg class="bi my-1 theme-icon-active" width="1em" height="1em"><use href="#circle-half"></use></svg>
      <span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
    </button>
    <ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="bd-theme-text">
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#sun-fill"></use></svg>
          Light
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
        </button>
      </li>
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark" aria-pressed="false">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#moon-stars-fill"></use></svg>
          Dark
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
        </button>
      </li>
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto" aria-pressed="true">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#circle-half"></use></svg>
          Auto
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
        </button>
      </li>
    </ul>
  </div>
    
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
  <symbol id="arrow-right-circle" viewBox="0 0 16 16">
    <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z"/>
  </symbol>
  <symbol id="bootstrap" viewBox="0 0 118 94">
    <title>Bootstrap</title>
    <path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z"></path>
  </symbol>
</svg>

  <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
  <div class="container-fluid">
    <a class="navbar-brand" href="../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#magick-navbars" aria-controls="magick-navbars" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="magick-navbars">
      <ul class="navbar-nav me-auto mb-2 mb-md-0">
        <li class="nav-item">
          <a class="nav-link " href="../www/download.html">Download</a>
        </li>
        <li class="nav-item">
          <a class="nav-link " href="../www/command-line-tools.html">Tools</a>
        </li>
        <li class="nav-item">
          <a class="nav-link " href="../www/command-line-processing.html">CLI</a>
        </li>
        <li class="nav-item">
          <a class="nav-link " href="../www/develop.html">Develop</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
        </li>
        <li class="nav-item">
          <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
        </li>
      </ul>
      <form class="d-flex form-inline" action="search.html">
        <input class="form-control me-2" type="text" name="q" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success" type="submit" name="sa">Search</button>
      </form>
    </div>
  </div>
  </nav>

<div class="col-lg-8 mx-auto p-4 py-md-5 text-body-secondary">
  <header class="d-flex align-items-center pb-3 mb-5 border-bottom">
    <a href="../" class="d-flex align-items-center text-decoration-none">
      <h1 class="fs-4">The FX Special Effects Image Operator</h1>
    </a>
  </header>

  <main class="container">
<div>
<p class="text-center"><a href="fx.html#fx">The FX Special Effects Image Operator</a> • <a href="fx.html#anatomy">The Anatomy of an FX Expression</a></p>

<a class="anchor" id="fx"></a>

<p class="lead">The <a href="http://im.snibgo.com/fxnew.htm" target="_blank">FX special effects image operator</a> applies a mathematical expression to each pixel channel of an image. The FX expression language provides a powerful and flexible way to manipulate images, allowing you to perform a wide range of operations and transformations on your images. Use FX to:</p>

<ul>
  <li>create canvases, gradients, mathematical colormaps</li>
  <li>move color values between images and channels</li>
  <li>translate, flip, mirror, rotate, scale, shear and generally distort images</li>
  <li>merge or composite multiple images together</li>
  <li>convolve or merge neighboring pixels together</li>
  <li>generate image metrics or 'fingerprints'</li>
</ul>

<p>The operator loops through all the pixels of an image and all the channels of each pixel and returns a new image with the results.  The expression can reference any image in the image sequence, but only a copy of the first image is returned with suitable updates per your expression.</p>

<p>The expression can be simple:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick -size 64x64 canvas:black -channel blue -fx "1/2" fx_navy.png
</samp></pre>

<p>Here, we convert a black to a navy blue image:</p>

<ul>
  <a href="../images/black.png"><img src="../images/black.png" width="64" height="64" alt="black" /></a>
  <img style="margin-top:22px; margin-bottom:22px;" src="../images/right.gif" width="20" height="20" alt="==>" />
  <a href="../images/navy.png"><img src="../images/navy.png" width="64" height="64" alt="navy" /></a>
</ul>

<p>Or the expression can be complex:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick rose: \
  -fx "(1.0/(1.0+exp(10.0*(0.5-u)))-0.006693)*1.0092503" \
  rose-sigmoidal.png
</samp></pre>

<p>This expression results in a high contrast version of the source image:</p>

<ul>
  <a href="../images/rose.jpg"><img src="../images/rose.jpg" width="70" height="46" alt="rose" /></a>
  <img style="margin-top:13px; margin-bottom:13px;" src="../images/right.gif" width="20" height="20" alt="==>" />
  <a href="../images/rose-sigmoidal.png"><img src="../images/rose-sigmoidal.png" width="70" height="46" alt="rose-sigmoidal" /></a>
</ul>

<p>The expression can include variable assignments.  Assignments, in most cases, reduce the complexity of an expression and permit some operations that might not be possible any other way.  For example, lets create a radial gradient:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick -size 70x70 canvas: \
  -fx "Xi=i-w/2; Yj=j-h/2; 1.2*(0.5-hypot(Xi,Yj)/70.0)+0.5" \
  radial-gradient.png
</samp></pre>

<p>The command above returns this image:</p>

<ul>
  <a href="../images/radial-gradient.png"><img src="../images/radial-gradient.png" width="70" height="70" alt="radial-gradient" /></a>
</ul>

<p>This FX expression adds random noise to an image:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick photo.jpg -fx 'iso=32; rone=rand(); rtwo=rand(); \
  myn=sqrt(-2*ln(rone))*cos(2*Pi*rtwo); myntwo=sqrt(-2*ln(rtwo))* \
  cos(2*Pi*rone); pnoise=sqrt(p)*myn*sqrt(iso)* \
  channel(4.28,3.86,6.68)/255; max(0,p+pnoise)' noisy.png
</samp></pre>

<p>This FX script utilizes a loop to create a <a href="https://en.wikipedia.org/wiki/Julia_set">Julia set</a>:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick -size 400x400 xc:gray -fx " \
  Xi=2.4*i/w-1.2; \
  Yj=2.4*j/h-1.2; \
  for (pixel=0.0, (hypot(Xi,Yj) &lt; 2.0) &amp;&amp; (pixel &lt; 1.0), \
    delta=Xi^2-Yj^2; \
    Yj=2.0*Xi*Yj+0.2; \
    Xi=delta+0.4; \
    pixel+=0.00390625 \
  ); \
  pixel == 1.0 ? 0.0 : pixel" \
  \( -size 1x1 xc:white xc:red xc:orange xc:yellow xc:green1 xc:cyan xc:blue \
     xc:blueviolet xc:white -reverse +append -filter Cubic -resize 1024x1! \) \
  -clut -rotate -90 julia-set.png</samp></pre>

<ul>
  <a href="../images/julia-set.png"><img src="../images/julia-set.png" width="160" height="160" alt="Julia Fractals" /></a>
</ul>

<p>This FX script prints the first 10 prime numbers:</p>
<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick xc:gray -fx " \
  for (prime=2, prime &lt; 30, composite=0; \
    for (nn=2, nn &lt; (prime/2+1), if ((prime % nn) == 0, composite++, ); nn++); \
      if (composite &lt;= 0, debug(prime), ); prime++)" null:</samp></pre>

<p>See <a href="../Usage/transform/index.html#fx">Using FX, The Special Effects Image Operator</a> for more examples.</p>

<p>The <samp>-fx</samp> option replaces any image sequence with a clone of the first image updated with the results of the expression.  If you prefer to apply the expression to each image in the sequence, use <samp>+fx</samp> instead.</p>

<p>The FX expression is interpretted in a single-thread, however, it is executed in multiple threads unless the expression includes the <code>debug()</code> function.</p>

<p>The next section discusses the FX expression language.</p>

<h2><a class="anchor" id="anatomy"></a>The Anatomy of an FX Expression</h2>

<h4>The FX Expression Language</h4>

<p>The formal FX expression language is defined here:</p>

<dl class="row">
  <dt class="col-md-4"> numbers:</dt>
  	<dd class="col-md-8"> integer, floating point, scientific notation (+/- required, e.g. 3.81469e-06), International System number postfixes (.e.g KB, Mib, GB, etc.)</dd>
  <dt class="col-md-4"> constants: </dt>
    <dd class="col-md-8"> E (Euler's number), Epsilon, Opaque, Phi (golden ratio), Pi, QuantumRange, QuantumScale, Transparent</dd>
  <dt class="col-md-4"> FX operators (in order of precedence): </dt>
     <dd class="col-md-8"> ^ (power), unary -, *, /, % (modulo), +, -,
     &lt;&lt;, &gt;&gt;, &lt;, &lt;=, &gt;, &gt;=, +=, -=, *=, /=, %=, &lt;&lt;=
, &gt;&gt;=,
     &amp;=, |=, ++, --, ==, !=, &amp; (bitwise AND),   | (bitwise OR),
     &amp;&amp; (logical AND),  || (logical OR),
     ~ (logical NOT),  ?: (ternary conditional)</dd>
  <dt class="col-md-4"> array: </dt>
    <dd class="col-md-8">an image offers array storage (e.g. p[-1,-1].r) bounded by its width and height.  An image sequence represents multiple arrays (e.g. u.p[0,0].r, v.p[0,0].r).  Storage is limited to Quantum values, e.g. [0..65535] for Q16 builds and floating point for HDRI-enabled builds.</dd>
  <dt class="col-md-4"> math functions: </dt>
     <dd class="col-md-8"> abs(), acos(), acosh(), airy(), alt(), asin(), asinh(), atan(), atanh(), atan2(), ceil(), clamp(), cos(), cosh(), debug(), drc(), erf(), exp(), floor(), gauss(), gcd(), hypot(), int(), isnan(), j0(), j1(), jinc(), ln(), log(), logtwo(), max(), min(), mod(), not(), pow(), rand(), round(), sign(), sin(), sinc(), sinh(), sqrt(), squish(), tan(), tanh(), trunc()</dd>
  <dt class="col-md-4"> channel functions: </dt>
    <dd class="col-md-8"> define up to 5 pixel channels</dd>
  <dt class="col-md-4"> color names:</dt>
    <dd class="col-md-8"> red, cyan, black, etc.</dd>
  <dt class="col-md-4"> color functions:</dt>
    <dd class="col-md-8"> srgb(), srgba(), rgb(), rgba(), cmyk(), cmyka(), hsl(), hsla(), etc.</dd>
  <dt class="col-md-4"> color hex values:</dt>
    <dd class="col-md-8"> #ccc, #cbfed0, #b9e1cc00, etc.</dd>
  <dt class="col-md-4"> symbols:</dt><dd class="col-md-8"><dl>
     <dd><samp>u</samp>: first image in list</dd>
     <dd><samp>v</samp>: second image in list</dd>
     <dd><samp>s</samp>: current image in list (for %[fx:] otherwise = u)</dd>
     <dd><samp>t</samp>: index of current image (s) in list</dd>
     <dd><samp>n</samp>: number of images in list</dd>

     <dd><samp>i</samp>: column offset</dd>
     <dd><samp>j</samp>: row offset</dd>
     <dd><samp>p</samp>: pixel to use (absolute or relative to current pixel)</dd>

     <dd><samp>w</samp>: width of this image</dd>
     <dd><samp>h</samp>: height of this image</dd>
     <dd><samp>z</samp>: channel depth</dd>

     <dd><samp>r</samp>: red value (from RGBA), of a specific or current pixel</dd>
     <dd><samp>g</samp>: green</dd>
     <dd><samp>b</samp>: blue</dd>
     <dd><samp>a</samp>: alpha</dd>
     <dd><samp>o</samp>: opacity</dd>

     <dd><samp>c</samp>: cyan value of CMYK color of pixel</dd>
     <dd><samp>y</samp>: yellow</dd>
     <dd><samp>m</samp>: magenta</dd>
     <dd><samp>k</samp>: black</dd>

     <dd><samp>all</samp>: all channels</dd>
     <dd><samp>this</samp>: this channel</dd>

     <dd><samp>intensity</samp>: pixel intensity</dd>

     <dd><samp>hue</samp>: pixel hue</dd>
     <dd><samp>saturation</samp>: pixel saturation</dd>
     <dd><samp>lightness</samp>: pixel lightness</dd>
     <dd><samp>luma</samp>: pixel luma</dd>

     <dd><samp>page.width</samp>: page width</dd>
     <dd><samp>page.height</samp>: page height</dd>
     <dd><samp>page.x</samp>: page x offset</dd>
     <dd><samp>page.y</samp>: page y offset</dd>

     <dd><samp>printsize.x</samp>: x printsize</dd>
     <dd><samp>printsize.y</samp>: y printsize</dd>

     <dd><samp>resolution.x</samp>: x resolution</dd>
     <dd><samp>resolution.y</samp>: y resolution</dd>

     <dd><samp>depth</samp>: image depth</dd>
     <dd><samp>extent</samp>: image extent</dd>
     <dd><samp>minima</samp>: image minima</dd>
     <dd><samp>maxima</samp>: image maxima</dd>
     <dd><samp>mean</samp>: image mean</dd>
     <dd><samp>median</samp>: image median</dd>
     <dd><samp>standard_deviation</samp>: image standard deviation</dd>
     <dd><samp>kurtosis</samp>: image kurtosis</dd>
     <dd><samp>skewness</samp>: image skewness (add a channel specifier to compute a statistic for that channel, e.g. depth.r)</dd></dl></dd>
  <dt class="col-md-4"> iterators:</dt>
    <dd class="col-md-8"> do(), for(), while()</dd>
  <dt class="col-md-4"> image attributes:</dt>
  	<dd class="col-md-8"> s.depth, s.kurtosis, s.maxima, s.mean, s.minima, s.resolution.x, s.resolution.y, s.skewness, s.standard_deviation</dd>
  <dt class="col-md-4"> user settings:</dt>
  	<dd class="col-md-8">define Fx symbols as user settings, e.g. <pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick ... -set option:wd1 "%[fx:w/2]" -resize "%[fx:wd1-5]" ...</samp></pre><dd>
</dl>

<h4>The FX Expression</h4>

<p>An FX expression may include any combination of the following:</p>
<dl class="row">
<dt class="col-md-4"> <var>x</var> <samp>^</samp> <var>y</var></dt><dd class="col-md-8"> exponentiation (<var>x<sup>y</sup></var>)</dd>
<dt class="col-md-4"> <samp>(</samp> ... <samp>)</samp></dt><dd class="col-md-8"> grouping</dd>
<dt class="col-md-4"> <var>x</var> <samp>*</samp> <var>y</var></dt><dd class="col-md-8"> multiplication</dd>
<dt class="col-md-4"> <var>x</var> <samp>/</samp> <var>y</var></dt><dd class="col-md-8"> division</dd>
<dt class="col-md-4"> <var>x</var> <samp>%</samp> <var>y</var></dt><dd class="col-md-8"> modulo</dd>
<dt class="col-md-4"> <var>x</var> <samp>+</samp> <var>y</var></dt><dd class="col-md-8"> addition</dd>
<dt class="col-md-4"> <var>x</var> <samp>-</samp> <var>y</var></dt><dd class="col-md-8"> subtraction</dd>
<dt class="col-md-4"> <var>x</var> <samp>&lt;&lt;</samp> <var>y</var></dt><dd class="col-md-8"> left shift</dd>
<dt class="col-md-4"> <var>x</var> <samp>&gt;&gt;</samp> <var>y</var></dt><dd class="col-md-8"> right shift</dd>
<dt class="col-md-4"> <var>x</var> <samp>&lt;</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x</var> &lt; <var>y</var>,  otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>&lt;=</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x</var> &lt;= <var>y</var>,  otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>&gt;</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x</var> &gt; <var>y</var>,  otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>&gt;=</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x</var> &gt;= <var>y</var>,  otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>==</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x </var>==<var> y</var>, otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>!=</samp> <var>y</var></dt><dd class="col-md-8"> boolean relation, return value 1.0 if <var>x </var>!=<var> y</var>, otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>&amp;</samp> <var>y</var></dt><dd class="col-md-8"> binary AND</dd>
<dt class="col-md-4"> <var>x</var> <samp>|</samp> <var>y</var></dt><dd class="col-md-8"> binary OR</dd>
<dt class="col-md-4"> <var>x</var> <samp>&amp;&amp;</samp> <var>y</var></dt><dd class="col-md-8"> logical AND connective, return value 1.0 if <var>x</var> &gt; 0 and <var>y</var> &gt; 0,  otherwise 0.0</dd>
<dt class="col-md-4"> <var>x</var> <samp>||</samp> <var>y</var></dt><dd class="col-md-8"> logical OR connective (inclusive), return value 1.0 if <var>x</var> &gt; 0 or <var>y</var> &gt; 0 (or both),  otherwise 0.0</dd>
<dt class="col-md-4"> <samp>~</samp><var>x</var></dt><dd class="col-md-8"> logical NOT operator, return value 1.0 if <var>not</var> <var>x</var> &gt; 0,  otherwise 0.0</dd>
<dt class="col-md-4"> <samp>+</samp><var>x</var></dt><dd class="col-md-8"> unary plus, return 1.0*value</dd>
<dt class="col-md-4"> <samp>-</samp><var>x</var></dt><dd class="col-md-8"> unary minus, return -1.0*value</dd>
<dt class="col-md-4"> <var>condition</var> <samp>?</samp> <var>true-statements</var> <samp>:</samp> <var>false-statements</var> </dt><dd class="col-md-8">ternary conditional expression, return value <var>true-statements</var> if <var>condition</var> != 0, otherwise <var>false-statements</var></dd>
<dt class="col-md-4"> <var>x</var> <samp>=</samp> <var>y</var></dt><dd class="col-md-8">assignment; single character variables are reserved, instead use 2 or more characters, letter combinations only (e.g. Xi not X1)</dd>
<dt class="col-md-4"> <var>x</var> <samp>;</samp> <var>y</var></dt><dd class="col-md-8">statement separator </dd>
<dt class="col-md-4"> <samp>phi</samp></dt><dd class="col-md-8"> constant (1.618034...)</dd>
<dt class="col-md-4"> <samp>pi</samp></dt><dd class="col-md-8"> constant (3.14159265359...)</dd>
<dt class="col-md-4"> <samp>e</samp></dt><dd class="col-md-8"> constant (2.71828...)</dd>
<dt class="col-md-4"> <samp>QuantumRange</samp></dt><dd class="col-md-8"> constant maximum pixel value (255 for Q8, 65535 for Q16)</dd>
<dt class="col-md-4"> <samp>QuantumScale</samp></dt><dd class="col-md-8"> constant 1.0/<samp>QuantumRange</samp></dd>
<dt class="col-md-4"> <samp>intensity</samp></dt><dd class="col-md-8"> pixel intensity whose value respects the <a href="../www/command-line-options.html#intensity">-intensity</a> option.</dd>
<dt class="col-md-4"> <samp>hue</samp></dt><dd class="col-md-8"> pixel hue</dd>
<dt class="col-md-4"> <samp>saturation</samp></dt><dd class="col-md-8"> pixel saturation</dd>
<dt class="col-md-4"> <samp>lightness</samp></dt><dd class="col-md-8"> pixel lightness; equivalent to 0.5*max(red,green,blue) + 0.5*min(red,green,blue)</dd>
<dt class="col-md-4"> <samp>luminance</samp></dt><dd class="col-md-8"> pixel luminance; equivalent to <samp>0.212656*red + 0.715158*green + 0.072186*blue</samp></dd>
<dt class="col-md-4"> <samp>red, green, blue</samp>, etc.</dt><dd class="col-md-8"> color names</dd>
<dt class="col-md-4"> <samp>#ccc, #cbfed0, #b9e1cc00</samp>, etc.</dt><dd class="col-md-8"> color hex values</dd>
<dt class="col-md-4"> <samp>rgb(), rgba(), cmyk(), cmyka(), hsl(), hsla()</samp></dt><dd class="col-md-8"> color functions</dd>
<dt class="col-md-4"> <samp>s, t, u, v, n, i, j, w, h, z, r, g, b, a, o, c, y, m, k</samp></dt><dd class="col-md-8"> symbols</dd>
<dt class="col-md-4"> <samp>abs(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> absolute value function</dd>
<dt class="col-md-4"> <samp>acos(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> arc cosine function</dd>
<dt class="col-md-4"> <samp>acosh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> inverse hyperbolic cosine function</dd>
<dt class="col-md-4"> <samp>airy(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> Airy function (max=1, min=0); airy(<var>x</var>)=[jinc(<var>x</var>)]<sup>2</sup>=[2*j1(<var>pi*x</var>)/(<var>pi*x</var>)]<sup>2</sup></dd>
<dt class="col-md-4"> <samp>alt(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> sign alternation function (return 1.0 if int(<var>x</var>) is even, -1.0 if int(<var>x</var>) is odd)</dd>
<dt class="col-md-4"> <samp>asin(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> arc sine function</dd>
<dt class="col-md-4"> <samp>asinh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> inverse hyperbolic sine function</dd>
<dt class="col-md-4"> <samp>atan(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> arc tangent function</dd>
<dt class="col-md-4"> <samp>atanh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> inverse hyperbolic tangent function</dd>
<dt class="col-md-4"> <samp>atan2(</samp><var>y</var>,<var>x</var><samp>)</samp></dt><dd class="col-md-8"> arc tangent function of two variables</dd>
<dt class="col-md-4"> <samp>ceil(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8">smallest integral value not less than argument</dd>
<dt class="col-md-4"> <samp>channel(</samp>...<samp>)</samp></dt><dd class="col-md-8">supports from zero to five arguments, e.g., channel(0.1) sets the first channel to 0.1 and zero's the other channels.</dd>
<dt class="col-md-4"> <samp>clamp(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> clamp value</dd>
<dt class="col-md-4"> <samp>cos(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> cosine function</dd>
<dt class="col-md-4"> <samp>cosh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> hyperbolic cosine function</dd>
<dt class="col-md-4"> <samp>debug(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> print <var>x</var> (useful for debugging your expression)</dd>
<dt class="col-md-4"> <samp>do(</samp><var>statements</var>, <var>condition</var><samp>)</samp></dt><dd class="col-md-8"> iterate while the condition is not equal to 0</dd>
<dt class="col-md-4"> <samp>drc(</samp><var>x</var>,<var>y</var><samp>)</samp></dt><dd class="col-md-8"> dynamic range compression (knee curve); drc(<var>x</var>,<var>y</var>)=(<var>x</var>)/(<var>y</var>*(<var>x</var>-1)+1); -1&lt;<var>y</var>&lt;1 </dd>
<dt class="col-md-4"> <samp>erf(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> error function</dd>
<dt class="col-md-4"> <samp>exp(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> natural exponential function (<var>e<sup>x</sup></var>)</dd>
<dt class="col-md-4"> <samp>floor(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> largest integral value not greater than argument</dd>
<dt class="col-md-4"> <samp>for(</samp><var>initialize</var>, <var>condition</var>, <var>statements</var><samp>)</samp></dt><dd class="col-md-8"> iterate while the condition is not equal to 0</dd>
<dt class="col-md-4"> <samp>gauss(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> gaussian function; gauss(<var>x</var>)=exp(<var>-x*x/2</var>)/sqrt(2*pi)</dd>
<dt class="col-md-4"> <samp>gcd(</samp><var>x</var>,<var>y</var><samp>)</samp></dt><dd class="col-md-8"> greatest common denominator</dd>
<dt class="col-md-4"> <samp>hypot(</samp><var>x</var>,<var>y</var><samp>)</samp></dt><dd class="col-md-8"> the square root of x<sup>2</sup>+y<sup>2</sup></dd>
<dt class="col-md-4"> <samp>if(</samp><var>condition</var>, <var>nonzero-statements</var>, <var>zero-statements</var><samp>)</samp></dt><dd class="col-md-8"> interpret expression depending on condition</dd>
<dt class="col-md-4"> <samp>int(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> greatest integer function (return greatest integer less than or equal to <var>x</var>)</dd>
<dt class="col-md-4"> <samp>isnan(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8">return 1.0 if <var>x</var> is NAN, 0.0 otherwise</dd>
<dt class="col-md-4"> <samp>j0(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> Bessel functions of <var>x</var> of the first kind of order 0</dd>
<dt class="col-md-4"> <samp>j1(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> Bessel functions of <var>x</var> of the first kind of order 1</dd>
<dt class="col-md-4"> <samp>jinc(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> jinc function (max=1, min=-0.1323); jinc(<var>x</var>)=2*j1(pi*<var>x</var>)/(pi*<var>*x</var>)</dd>
<dt class="col-md-4"> <samp>ln(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> natural logarithm function</dd>
<dt class="col-md-4"> <samp>log(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> logarithm base 10</dd>
<dt class="col-md-4"> <samp>logtwo(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> logarithm base 2</dd>
<dt class="col-md-4"> <samp>ln(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> natural logarithm</dd>
<dt class="col-md-4"> <samp>max(</samp><var>x</var>, <var>y</var><samp>)</samp></dt><dd class="col-md-8"> maximum of <var>x</var> and <var>y</var></dd>
<dt class="col-md-4"> <samp>min(</samp><var>x</var>, <var>y</var><samp>)</samp></dt><dd class="col-md-8"> minimum of <var>x</var> and <var>y</var></dd>
<dt class="col-md-4"> <samp>mod(</samp><var>x</var>, <var>y</var><samp>)</samp></dt><dd class="col-md-8"> floating-point remainder function</dd>
<dt class="col-md-4"> <samp>not(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> return 1.0 if <var>x</var> is zero, 0.0 otherwise</dd>
<dt class="col-md-4"> <samp>pow(</samp><var>x</var>,<var>y</var><samp>)</samp></dt><dd class="col-md-8"> power function (<var>x<sup>y</sup></var>)</dd>
<dt class="col-md-4"> <samp>rand()</samp></dt><dd class="col-md-8"> value uniformly distributed over the interval [0.0, 1.0) with a 2 to the 128th-1 period</dd>
<dt class="col-md-4"> <samp>round()</samp></dt><dd class="col-md-8"> round to integral value, regardless of rounding direction</dd>
<dt class="col-md-4"> <samp>sign(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> return -1.0 if <var>x</var> is less than 0.0 otherwise 1.0</dd>
<dt class="col-md-4"> <samp>sin(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> sine function</dd>
<dt class="col-md-4"> <samp>sinc(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> sinc function (max=1, min=-0.21); sinc(<var>x</var>)=sin(<var>pi*x</var>)/(<var>pi*x</var>)</dd>
<dt class="col-md-4"> <samp>squish(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> squish function; squish(<var>x</var>)=1.0/(1.0+exp(<var>-x</var>))</dd>
<dt class="col-md-4"> <samp>sinh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> hyperbolic sine function</dd>
<dt class="col-md-4"> <samp>sqrt(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> square root function</dd>
<dt class="col-md-4"> <samp>tan(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> tangent function</dd>
<dt class="col-md-4"> <samp>tanh(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> hyperbolic tangent function</dd>
<dt class="col-md-4"> <samp>trunc(</samp><var>x</var><samp>)</samp></dt><dd class="col-md-8"> round to integer, towards zero</dd>
<dt class="col-md-4"> <samp>while(</samp><var>condition</var>, <var>statements</var><samp>)</samp></dt><dd class="col-md-8"> iterate while the condition is not equal to 0</dd>
<dt class="col-md-4"> <samp>image.depth, image.kurtosis, image.maxima, image.mean, image.median, image.minima, image.resolution.x, image.resolution.y, image.skewness, image.standard_deviation</samp></dt><dd class="col-md-8"> image attributes</dd>
</dl>
<p>The expression semantics include these rules:</p>

<ul>
<li>symbols are case insensitive</li>
<li>only one ternary conditional (e.g. x ? y : z) per statement</li>
<li>statements are assignments or the final expression to return</li>
<li>an assignment starts a statement, it is not an operator</li>
<li>single character variables are reserved.  Assignments to reserved built-ins throw an exception;  e.g. <samp>r=3.0; r</samp> returns <em>Attempted assignment to non-UserSymbol 'r' at '3.0'</em>.</li>
<li>unary operators have a lower priority than binary operators, that is, the unary minus (negation) has lower precedence than exponentiation, so -3^2 is interpreted as -(3^2) = -9.  Use parentheses to clarify your intent (e.g. (-3)^2 = 9).</li>
<li>care must be exercised when using the slash ('/') symbol. The string of characters <var>1/2x</var> is interpreted as (1/2)x. The contrary interpretation should be written explicitly as 1/(2x). Again, the use of parentheses helps clarify the meaning and should be used whenever there is any chance of misinterpretation.</li>
<li>As <samp>--<samp> is the variable decrement operator, use parenthesis to subtract a negative number, e.g, <samp>-4-(-5)</samp>.</li>
</ul>
<br/>


<h4>Source Images</h4>

<p>The symbols <samp>u</samp> and <samp>v</samp> refer to the first and second images, respectively, in the current image sequence.  Refer to a particular image in a sequence by appending its index to any image reference (usually <samp>u</samp>), with a zero index for the beginning of the sequence. A negative index counts from the end.  For example, <samp>u[0]</samp> is the first image in the sequence, <samp>u[2]</samp> is the third, <samp>u[-1]</samp> is the last image, and <samp>u[t]</samp> is the current image. The current image can also be referenced by <samp>s</samp>. If the sequence number exceeds the length of the sequence, the count is wrapped. Thus in a 3-image sequence,  <samp>u[-1]</samp>, <samp>u[2]</samp>, and <samp>u[5]</samp> all refer to the same (third) image.</p>

<p>As an example, we form an image by averaging the first image and third images (the second (index 1) image is ignored and just junked):</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick image1.jpg image2.jpg image3.jpg -fx "(u+u[2])/2" image.jpg
</samp></pre>

<p>By default, the image to which <samp>p</samp>, <samp>r</samp>, <samp>g</samp>, <samp>b</samp>, <samp>a</samp>, etc., are applied is the current image <samp>s</samp> in the image list. This is equivalent to <samp>u</samp> except when used in an escape sequence <samp>%[fx:...]</samp>. </p>

<p>It is important to note the special role played by the first image. This is the only image in the image sequence that is modified, other images are used only for their data. As an illustrative example, consider the following, and note that the setting <a href="../www/command-line-options.html#channel">-channel red</a> instructs <a href="../www/command-line-options.html#fx">-fx</a> to modify only the green channel; nothing in the red or blue channels will change. It is instructive to ponder why the result is not symmetric.</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick logo: -flop logo: -resize "20%" -channel green -fx "(u+v)/2" image.jpg
</samp></pre>

<ul>
  <a href="../images/logo-sm-flop.png"><img src="../images/logo-sm-flop.png" width="128" height="96" alt="logo-sm-flop.png" /></a>
  <a href="../images/logo-sm.png"><img src="../images/logo-sm.png" width="128" height="96" alt="logo-sm.png" /></a>
<img style="margin-top:38px; margin-bottom:38px;" src="../images/right.gif" width="20" height="20" alt="==>" />
  <a href="../images/logo-sm-fx.png"><img src="../images/logo-sm-fx.png" width="128" height="96" alt="logo-sm-fx.png" /></a>
</ul>

<br/>
<h4>Accessing Pixels</h4>

<p>All color values are normalized to the range of 0.0 to 1.0.  The alpha channel ranges from 0.0 (fully transparent) to 1.0 (fully opaque).</p>

<p>The pixels are processed one at a time, but a different pixel of an image can be specified using a pixel index represented by <samp>p</samp>. For example,</p>

<pre class="p-3 mb-2 bg-light text-dark"><samp>p[-1].g      green value of pixel to the immediate left of the current pixel
p[-1,-1].r   red value of the pixel diagonally left and up from current pixel
</samp></pre>

<p>To specify an absolute position, use braces, rather than brackets.</p>

<pre class="p-3 mb-2 bg-light text-dark"><samp>p{0,0}.r     red value of the pixel in the upper left corner of the image
p{12,34}.b   blue pixel value at column number 12, row 34 of the image
</samp></pre>

<p>Integer values of the position retrieve the color of the pixel referenced, while non-integer position values return a blended color according to the current <a href="../www/command-line-options.html#interpolate">-interpolate</a> setting.</p>

<p>A position outside the boundary of the image retrieves a value dictated by the <a href="../www/command-line-options.html#virtual-pixel">-virtual-pixel</a> option setting.</p>

<p>Specify <samp>u.r</samp> to specify the red channel of the current image. If you don't specify a channel qualifier, you get the current channel. Use <samp>mean.this</samp> to set the output channel to the mean of just the input channel.  Use <samp>mean.all</samp> to set the overall mean of the input channels.</p>

<h4>Apply an Expression to Select Image Channels</h4>

<p>Use the <a href="../www/command-line-options.html#channel">-channel</a> setting to specify the output channel of the result. If no output channel is given, the result is set over all channels except the opacity channel. For example, to replace the red channel of <samp>alpha.png</samp> with the average of the green channels from the images <samp>alpha.png</samp> and <samp>beta.png</samp>, use:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick alpha.png beta.png -channel red -fx "(u.g+v.g)/2" gamma.png
</samp></pre>


<h4>Results</h4>

<p>The <a href="../www/command-line-options.html#fx">-fx</a> operator evaluates the given expression for each channel (set by <a href="../www/command-line-options.html#channel">-channel</a>) of each pixel in the first image (<samp>u</samp>) in the sequence. The computed values are temporarily stored in a copy (clone) of that first image until all the pixels have been processed, after which this single new image replaces the list of images in the current image sequence.  As such, in the previous example the updated version of <samp>alpha.png</samp> replaces both of the original images, <samp>alpha.png</samp> and <samp>beta.png</samp>, before being saved as <samp>gamma.png</samp>.</p>

<p>The current image <samp>s</samp> is set to the first image in the sequence (<samp>u</samp>), and <samp>t</samp> to its index, 0.  The symbols <samp>i</samp> and <samp>j</samp> reference the current pixel being processed.</p>


<p>For use with <a href="../www/command-line-options.html#format_identify_">-format</a>, the value-escape <samp>%[fx:]</samp> is evaluated just once for each image in the current image sequence. As each image in the sequence is being evaluated, <samp>s</samp> and <samp>t</samp> successively refer to the current image and its index, while <samp>i</samp> and <samp>j</samp> are set to zero, and the current channel set to red (<a href="../www/command-line-options.html#channel">-channel</a> is ignored). An example:</p>

<pre class="p-3 mb-2 bg-light text-dark"><samp>$ magick canvas:'rgb(25%,50%,75%)' rose: -colorspace gray  \
  -format 'Red channel of NW corner of image #%[fx:t] is %[fx:s]\n' info:
Red channel of NW corner of image #0 is 0.464883
Red channel of NW corner of image #1 is 0.184582
</samp></pre>

<p>Here we use the image indexes to <var>rotate</var> each image differently, and use <samp>-set</samp> with the image index to set a different <var>pause delay</var> on the first image in the animation:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick rose: -duplicate 29 -virtual-pixel Gray -distort SRT '%[fx:360.0*t/n]' \
  -set delay '%[fx:t == 0 ? 240 : 10]' -loop 0 rose.gif
</samp></pre>

<p>This example tests the difference between two images, measured by RMSE. If the difference is greater than 0.1 it returns 1; otherwise it returns 0:</p>

<pre class="p-3 mb-2 bg-light text-dark cli"><samp>magick water.png reference.png -metric RMSE -compare -format "%[fx:%[distortion]>0.1]" info:</samp></pre>

<p>The color-escape <samp>%[pixel:]</samp> or <samp>%[hex:]</samp> is evaluated once per image and per color channel in that image (<a href="../www/command-line-options.html#channel">-channel</a> is ignored), The values generated are then converted into a color string (a named color or hex color value).  The symbols <samp>i</samp> and <samp>j</samp> are set to zero, and <samp>s</samp> and <samp>t</samp> refer to each successively current image and index.</p>

</div>
  </div>
  </main><!-- /.container -->
  <footer class="py-5 text-center text-body-secondary bg-body-tertiary">
    <div class="container-fluid">
      <a href="../www/security-policy.html">Security</a> •
      <a href="../www/news.html">News</a>
     
      <a href="fx.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
     
      <a href="../www/links.html">Related</a> •
      <a href="../www/sitemap.html">Sitemap</a>
   <br/>
     <a href="../www/support.html">Sponsor</a> •
     <a href="../www/cite.html">Cite</a> •
     <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
     <a href="../www/https://imagemagick.org/script/contact.php">Contact Us</a>
   <br/>
     <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> •
     <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 300 300" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path d="M178.57 127.15 290.27 0h-26.46l-97.03 110.38L89.34 0H0l117.13 166.93L0 300.25h26.46l102.4-116.59 81.8 116.59h89.34M36.01 19.54H76.66l187.13 262.13h-40.66"/></svg></a>
    <br/>
    <small>Copyright © 1999 ImageMagick Studio LLC</small>
    </div>
  </footer>
</div>

  <!-- Javascript assets -->
  <script src="assets/magick.js" ></script>
  </body>
</html>
<!-- Magick Cache 19th April 2024 12:43 -->