config root man

Current Path : /usr/local/share/doc/ImageMagick/www/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/share/doc/ImageMagick/www/fx.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <style type="text/css" media="screen,projection"><!--
    @import url("../www/magick.css");
  --></style>
  <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U=" />
  <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf" />
  <title>ImageMagick: The Fx Special Effects Image Operator</title>
  <meta http-equiv="Content-Language" content="en-US"/>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/>
  <meta name="Generator" content="PHP"/>
  <meta name="Keywords" content="the, fx, special, effects, image, operator, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject"/>
  <meta name="Description" content="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 (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images automagically and dynamically."/>
  <meta name="Rating" content="GENERAL"/>
  <meta name="Robots" content="INDEX, FOLLOW"/>
  <meta name="Generator" content="ImageMagick Studio LLC"/>
  <meta name="Author" content="ImageMagick Studio LLC"/>
  <meta name="Revisit-after" content="2 DAYS"/>
  <meta name="Resource-type" content="document"/>
  <meta name="Copyright" content="Copyright (c) 1999-2009 ImageMagick Studio LLC"/>
  <meta name="Distribution" content="Global"/>
  <link rel="shortcut icon" href="../images/wand.ico"  type="images/vnd.microsoft.icon"/>
</head>

<body id="www-imagemagick-org">
<div class="titlebar">
<a href="../index.html">
  <img src="../images/script.png" alt="[ImageMagick]"
  style="width: 350px; height: 60px; margin: 28px auto; float: left;" /></a>
<a href="http://www.networkredux.com">
  <img src="../images/networkredux.png" alt="[sponsor]"
  style="margin: 45px auto; border: 0px; float: left;" /></a>
<a href="http://www.imagemagick.org/discourse-server/">
  <img src="../images/logo.jpg" alt=""
  style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
<a href="../index.html">
  <img src="../images/sprite.jpg" alt=""
  style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
</div>

<div class="eastbar">

<div class="menu">
  <a href="../index.html">About ImageMagick</a>
</div>
<div class="sep"></div>
 <div  class="menu">
 	<a href="../www/command-line-tools.html">Command-line Tools</a>
 </div>
 <div  class="sub">
      <a href="../www/command-line-processing.html">Processing</a>
 </div>
 <div  class="sub">
      <a href="../www/command-line-options.html">Options</a>
 </div>
 <div  class="sub">
      <a href="http://www.imagemagick.org/Usage/">Usage</a>
 </div>
 <div  class="menu">
      <a href="../www/api.html">Program Interfaces</a>
 </div>
 <div  class="sub">
      <a href="../www/magick-wand.html">MagickWand</a>
 </div>
 <div  class="sub">
      <a href="../www/magick-core.html">MagickCore</a>
 </div>
 <div  class="sub">
      <a href="../www/perl-magick.html">PerlMagick</a>
 </div>
 <div  class="sub">
      <a href="../Magick++/">Magick++</a>
 </div>
<div class="menu">
  <a href="../www/architecture.html">Architecture</a>
</div>
<div class="sep"></div>
 <div  class="menu">
      <a href="../www/install-source.html">Install from Source</a>
 </div>
 <div  class="sub">
      <a href="../www/install-source.html#unix">Unix</a>
 </div>
 <div  class="sub">
      <a href="../www/install-source.html#windows">Windows</a>
 </div>
<div class="menu">
      <a href="../www/binary-releases.html">Binary Releases</a>
</div>
<div class="sub">
      <a href="../www/binary-releases.html#unix">Unix</a>
</div>
<div class="sub">
      <a href="../www/binary-releases.html#macosx">Mac OS X</a>
</div>
<div class="sub">
      <a href="../www/binary-releases.html#windows">Windows</a>
</div>
<div class="menu">
      <a href="../www/resources.html">Resources</a>
</div>
<div class="sep"></div>
<div class="menu">
      <a href="../www/download.html">Download</a>
</div>
<div class="sep"></div>
<div class="menu">
      <a href="http://www.imagemagick.org/script/search.php">Search</a>
</div><div class="sep"></div>
<div class="menu">
    <a href="../www/sitemap.html">Site Map</a>
</div>
<div  class="sub">
	<a href="../www/links.html">Links</a>
</div>
<div class="sep"></div>
<div  class="menu">
       <a href="../www/sponsors.html">Sponsors:</a>

<div class="sponsbox">
<div  class="sponsor">
   <a href="http://www.wischmop-shop.de">Wischmop</a><!-- 200905070040+ -->
</div>
<div  class="sponsor">
      <a href="http://www.who-sells-it.com/">Free Catalogs</a><!-- 201002010000 -->
</div>
<div  class="sponsor">
      <a href="http://www.online-kredit-index.de">Kredit</a><!-- 200905010120 -->
</div>
<div  class="sponsor">
      <a href="http://www.posters555.com">Poster</a><!-- 200903010800 -->
</div>

</div>

</div>


</div>

<div class="main">

<p class="navigation-index">[<a href="#fx">The Fx Special Effects Image Operator</a> | <a href="#anatomy">The Anatomy of an Fx Expression</a>]</p>

<div style="margin: auto;">
  <h2><a name="fx"></a>The Fx Special Effects Image Operator</h2>
</div>

<p>Use the Fx special effects image operator to apply a mathematical expression to an image or image channels.  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 expression can be simple--</p>

<pre class="text">
  convert -size 64x64 xc:black -channel blue -fx "1/2" fx_navy.png
</pre>

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

<p class="image">
  <a href="../images/black.png"><img src="../images/black.png" width="64" height="64" align="middle" alt="black" /></a>
  <img src="../images/right.gif" width="20" height="20" align="middle" alt="==>" />
  <a href="../images/navy.png"><img src="../images/navy.png" width="64" height="64" align="middle" alt="navy" /></a>
</p>

<p>-- or complex:</p>

<pre class="text">
  convert rose.jpg \
          -fx "(1.0/(1.0+exp(10.0*(0.5-u)))-0.006693)*1.0092503" \
          rose-sigmoidal.png
</pre>

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

<p class="image">
  <a href="../images/rose.jpg"><img src="../images/rose.jpg" width="70" height="46" align="middle" alt="rose" /></a>
  <img src="../images/right.gif" width="20" height="20" align="middle" alt="==>" />
  <a href="../images/rose-sigmoidal.png"><img src="../images/rose-sigmoidal.png" width="70" height="46" align="middle" alt="rose-sigmoidal" /></a>
</p>

<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="text">
  convert -size 70x70 xc: \
          -fx "Xi=i-w/2; Yj=j-h/2; 1.2*(0.5-hypot(Xi,Yj)/70.0)+0.5" \
          radial-gradient.png
</pre>

<p>These statements return this image:</p>

<p class="image">
  <a href="../images/radial-gradient.png"><img src="../images/radial-gradient.png" width="70" height="70" align="middle" alt="radial-gradient" /></a>
</p>
<p>See <a href="http://www.imagemagick.org/Usage/transform/index.html#fx" target="1980638568">Using FX, The Special Effects Image Operator</a> for more examples on how to     apply a mathematical expression to an image or image channels.</p>

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

<div style="margin: auto;">
  <h2><a name="anatomy"></a>The Anatomy of an Fx Expression</h2>
</div>

<h5>The Fx Expression Language</h5>

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

<pre class="text">
  numbers: integer, floating point, or scientfic notation (+/- required, e.g. 3.81469e-06)
  constants: e, Epsilon, QuantumRange, QuantumScale, Opaque, Pi, Transparent
  Fx operators (in order of precedence):
     ^ (power), *, /, % (modulo), +, -,
     &lt;&lt;, &gt;&gt;, &lt;, &lt;=, &gt;, &gt;=, ==, !=,
     &amp; (bitwise AND),   | (bitwise OR),
     &amp;&amp; (logical AND),  || (logical OR),
     ~ (logical NOT),  ?: (ternary conditional)
  math functions:
     abs(), acos(), alt(), asin(), atan(), atan2(), ceil(), cos(), cosh(), debug(), exp(), floor(),
     hypot(), int(), ln(), log(), logtwo(), max(), min(), mod(), pow(), rand(), round(),
     sign(), sin(), sinh(), sqrt(), tan(), tanh()
  channel functions: channel(r,g,b,a), channel(c,m,y,k,a)
  color names: red, cyan, black, etc.
  color functions: rgb(), rgba(), cmyk(), cmyka(), hsl(), hsla()
  color hex values: #ccc, #cbfed0, #b9e1cc00
  symbols:
     s = current image in sequence
     t = scene number of current image in sequence
     u = first image in sequence
     v = second image in sequence
     n = number of images in sequence

     i = column offset
     j = row offset
     p = pixel to use (absolute or relative to current pixel)

     w = width of this image
     h = height of this image
     z = channel depth

     r = red value (from RGBA), of a specific or current pixel
     g = green    ''
     b = blue     ''
     a = alpha    ''
     o = opacity  ''

     c = cyan value of CMYK color of pixel
     y = yellow   ''
     m = magenta  ''
     k = black    ''

     intensity = pixel intensity

     hue = pixel hue
     saturation = pixel saturation
     lightness = pixel lightness
     luminance = pixel luminance

     page.width = page width
     page.height = page height
     page.x = page x offset
     page.y = page y offset

     resolution.x = x resolution
     resolution.y = y resolution

     depth = image depth
     minima = image minima
     maxima = image maxima
     mean = image mean
     standard_deviation = image standard deviation
     kurtosis = image kurtosis
     skewness = image skewness
       (add a channel specifier to compute a statistic for that channel, e.g. depth.r)
</pre>

<h5>The Fx Expression</h5>

<p>The Fx expressions includes any combination of the following:</p>
<ul>
<li> <em>x</em> <kbd>^</kbd> <em>y</em>:  exponentiation (<em>x<sup>y</sup></em>)</li>
<li> <kbd>(</kbd> ... <kbd>)</kbd>:  grouping</li>
<li> <em>x</em> <kbd>*</kbd> <em>y</em>:  multiplication (the asterisk <kbd>*</kbd> is optional, for example, <kbd>2u</kbd> or <kbd>2(x+y)</kbd> are acceptable)</li>
<li> <em>x</em> <kbd>/</kbd> <em>y</em>:  division</li>
<li> <em>x</em> <kbd>%</kbd> <em>y</em>:  modulo</li>
<li> <em>x</em> <kbd>+</kbd> <em>y</em>:  addition</li>
<li> <em>x</em> <kbd>-</kbd> <em>y</em>:  subtraction</li>
<li> <em>x</em> <kbd>&lt;&lt;</kbd> <em>y</em>:  left shift</li>
<li> <em>x</em> <kbd>&gt;&gt;</kbd> <em>y</em>:  right shift</li>
<li> <em>x</em> <kbd>&lt;</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x</em> &lt; <em>y</em>,  otherwise 0.0</li>
<li> <em>x</em> <kbd>&lt;=</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x</em> &lt;= <em>y</em>,  otherwise 0.0</li>
<li> <em>x</em> <kbd>&gt;</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x</em> &gt; <em>y</em>,  otherwise 0.0</li>
<li> <em>x</em> <kbd>&gt;=</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x</em> &gt;= <em>y</em>,  otherwise 0.0</li>
<li> <em>x</em> <kbd>==</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x </em>==<em> y</em>, otherwise 0.0</li>
<li> <em>x</em> <kbd>!=</kbd> <em>y</em>:  boolean relation, return value 1.0 if <em>x </em>!=<em> y</em>, otherwise 0.0</li>
<li> <em>x</em> <kbd>&amp</kbd> <em>y</em>:  binary AND</li>
<li> <em>x</em> <kbd>|</kbd> <em>y</em>:  binary OR</li>
<li> <em>x</em> <kbd>&amp;&amp;</kbd> <em>y</em>:  logical AND connective, return value 1.0 if <em>x</em> &gt; 0 and <em>y</em> &gt; 0,  otherwise 0.0</li>
<li> <em>x</em> <kbd>||</kbd> <em>y</em>:  logical OR connective (inclusive), return value 1.0 if <em>x</em> &gt; 0 or <em>y</em> &gt; 0 (or both),  otherwise 0.0</li>
<li> <kbd>~</kbd><em>x</em>:  logical NOT operator, return value 1.0 if <em>not</em> <em>x</em> &gt; 0,  otherwise 0.0</li>
<li> <kbd>+</kbd><em>x</em>:  unary plus, return 1.0*value</li>
<li> <kbd>-</kbd><em>x</em>:  unary minus, return -1.0*value</li>
<li> <em>x</em> <kbd>?</kbd> <em>y</em> :</b> <em>z</em>: ternary conditional expression, return value <em>y</em> if <em>x</em> != 0, otherwise <em>z</em>; only one ternary conditional permitted per statement</li>
<li> <em>x</em> <kbd>=</kbd> <em>y</em>: assignment; assignment variables are restricted to letter combinations only (e.g. Xi not X1)</li>
<li> <em>x</em> <kbd>;</kbd> <em>y</em>: statement separator </li>
<li> <kbd>pi</kbd>:  constant (3.141659...)</li>
<li> <kbd>e</kbd>:  constant (2.71828...)</li>
<li> <kbd>QuantumRange</kbd>:  constant maximum pixel value (255 for Q8, 65535 for Q16)</li>
<li> <kbd>QuantumScale</kbd>:  constant 1.0/<kbd>QuantumRange</kbd></li>
<li> <kbd>intensity</kbd>:  pixel intensity; equivalent to 0.299*red+0.587*green+0.114*blue</li>
<li> <kbd>hue</kbd>:  pixel hue</li>
<li> <kbd>saturation</kbd>:  pixel saturation</li>
<li> <kbd>lightness</kbd>:  pixel lightness; equivalent to 0.5*max(red,green,blue) + 0.5*min(red,green,blue)</li>
<li> <kbd>luminance</kbd>:  pixel luminance; equivalent to 0.2126*red + 0.7152*green + 0.0722*blue</li>
<li> <kbd>red, green, blue</kbd>, etc.:  color names</li>
<li> <kbd>#ccc, #cbfed0, #b9e1cc00</kbd>, etc.:  color hex values</li>
<li> <kbd>rgb(), rgba(), cmyk(), cmyka(), hsl(), hsla()</kbd>:  color functions</li>
<li> <kbd>s, t, u, v, n, i, j, w, h, z, r, g, b, a, o, c, y, m, k</kbd>:  symbols</li>
<li> <kbd>abs(</kbd><em>x</em><kbd>)</kbd>:  absolute value function</li>
<li> <kbd>acos(</kbd><em>x</em><kbd>)</kbd>:  arc cosine function</li>
<li> <kbd>alt(</kbd><em>x</em><kbd>)</kbd>:  sign alternation function (return 1.0 if <kbd>int(</kbd><em>x</em><kbd>)</kbd> is even, -1.0 if <kbd>int(</kbd><em>x</em><kbd>)</kbd> is odd)</li>
<li> <kbd>asin(</kbd><em>x</em><kbd>)</kbd>:  arc sine function</li>
<li> <kbd>atan(</kbd><em>x</em><kbd>)</kbd>:  arc tangent function</li>
<li> <kbd>atan2(</kbd><em>y</em>,<em>x</em><kbd>)</kbd>:  arc tangent function of two variables</li>
<li> <kbd>ceil(</kbd><em>x</em><kbd>)</kbd>: smallest integral value not less than argument</li>
<li> <kbd>channel(</kbd><em>r</em>,<em>g</em>,<em>b</em>,<em>a</em><kbd>)</kbd>: select numeric argument based on current channel</li>
<li> <kbd>channel(</kbd><em>c</em>,<em>m</em>,<em>y</em>,<em>k</em>,<em>a</em><kbd>)</kbd>: select numeric argument based on current channel</li>
<li> <kbd>cos(</kbd><em>x</em><kbd>)</kbd>:  cosine function</li>
<li> <kbd>cosh(</kbd><em>x</em><kbd>)</kbd>:  hyperbolic cosine function</li>
<li> <kbd>debug(</kbd><em>x</em><kbd>)</kbd>:  print <em>x</em> (useful for debugging your expression)</li>
<li> <kbd>exp(</kbd><em>x</em><kbd>)</kbd>:  natural exponential function (<em>e<sup>x</sup></em>)</li>
<li> <kbd>floor(</kbd><em>x</em><kbd>)</kbd>:  largest integral value not greater than argument</li>
<li> <kbd>hypot(</kbd><em>x</em>,<em>y</em><kbd>)</kbd>:  the square root of x<sup>2</sup>+y<sup>2</sup></li>
<li> <kbd>int(</kbd><em>x</em><kbd>)</kbd>:  greatest integer function (return greatest integer less than or equal to <em>x</em>)</li>
<li> <kbd>ln(</kbd><em>x</em><kbd>)</kbd>:  natural logarithm function</li>
<li> <kbd>log(</kbd><em>x</em><kbd>)</kbd>:  logarithm base 10</li>
<li> <kbd>logtwo(</kbd><em>x</em><kbd>)</kbd>:  logarithm base 2</li>
<li> <kbd>ln(</kbd><em>x</em><kbd>)</kbd>:  natural logarithm</li>
<li> <kbd>max(</kbd><em>x</em>,</b> <em>y</em><kbd>)</kbd>:  maximum of <em>x</em> and <em>y</em></li>
<li> <kbd>min(</kbd><em>x</em>,</b> <em>y</em><kbd>)</kbd>:  minimum of <em>x</em> and <em>y</em></li>
<li> <kbd>mod(</kbd><em>x</em>,</b> <em>y</em><kbd>)</kbd>:  floating-point remainder function</li>
<li> <kbd>pow(</kbd><em>x</em>,<em>y</em><kbd>)</kbd>:  power function (<em>x<sup>y</sup></em>)</li>
<li> <kbd>rand()</kbd>:  value uniformly distributed over the interval [0.0, 1.0) with a 2 to the 128th-1 period</li>
<li> <kbd>round()</kbd>:  round to integral value, regardless of rounding direction</li>
<li> <kbd>sign(</kbd><em>x</em><kbd>)</kbd>:  return -1.0 if <em>x</em> is less than 0.0 otherwise 1.0</li>
<li> <kbd>sin(</kbd><em>x</em><kbd>)</kbd>:  sine function</li>
<li> <kbd>sinh(</kbd><em>x</em><kbd>)</kbd>:  hyperbolic sine function</li>
<li> <kbd>sqrt(</kbd><em>x</em><kbd>)</kbd>:  square root function</li>
<li> <kbd>tan(</kbd><em>x</em><kbd>)</kbd>:  tangent function</li>
<li> <kbd>tanh(</kbd><em>x</em><kbd>)</kbd>:  hyperbolic tangent function</li>
</ul>

<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>assignments to built-ins do not throw an exception and have no effect;  e.g. <kbd>r=3.0; r</kbd> returns the pixel red color value, not 3.0</li>
</ul>

<h5>Source Image</h5>

<p>The default image for <kbd>p</kbd>, <kbd>r</kbd>, <kbd>g</kbd>, <kbd>b</kbd>, <kbd>a</kbd>, etc. is <kbd>s</kbd>  which refers to the current image being looked at in <a href="../www/command-line-options.html#format" target="magick-options">%[fx: ]</a> and <a href="../www/command-line-options.html#format" target="magick-options">%[pixel: ]</a> escapes.  The <kbd>-fx</kbd> image <kbd>s</kbd> defaults to the first (zeroth) image <kbd>u</kbd>.  The index of <kbd>s</kbd> is given by <kbd>t</kbd>.</p>

<p>The symbol <kbd>u</kbd> refers to the first (zeroth) image in the current image sequence, <kbd>v</kbd> the second image.  Refer to a particular image in a sequence by appending its index to any image reference (usually <kbd>u</kbd>). A negative index counts from the end.  For example, <kbd>u[2]</kbd> is the third image the sequence, <kbd>u[-1]</kbd> is the last image, and <kbd>u[t]</kbd> is <kbd>s</kbd>.</p>

<p>As an example, we reduce the intensity of the red channel by 50%:</p>

<pre class="text">
  convert image.png -channel red -fx "u/2.0" image.jpg
</pre>

<h5>Accessing Pixels</h5>

<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>The pixels are processed one at a time, but a different pixel of a image can be specified with a pixel index represented by <kbd>p</kbd>. For example,</p>

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

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

<pre class="text">
  p{12,34}.b   blue pixel value at the 12th column and 34th row of the image
</pre>

<p>The other symbols specify the value you wish to retrieve.</p>

<p>Integer pixel references retrieve the color of the pixel referred to, whereas non-integer references return a blended color according to the current <a href="../www/command-line-options.html#interpolate" target="magick-options">-interpolate</a> setting.</p>


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

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

<p>Use the <a href="../www/command-line-options.html#channel" target="magick-options">-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, suppose you want to replace the red channel of <kbd>alpha.png</kbd> with the average of the green channels from the images <kbd>alpha.png</kbd> and <kbd>beta.png</kbd>, use:</p>

<pre class="text">
  convert alpha.png beta.png -channel red -fx "(u.g+v.g)/2" gamma.png
</pre>

<h5>Results</h5>

<p>The <kbd>-fx</kbd> operator evaluates the given expression once for each pixel in the first image (<em>u</em>) in the sequence for each <a href="../www/command-line-options.html#channel" target="magick-options">channel</a>. The computed value is placed in a copy (clone) of that first image.  This new image replaces all images in the current image sequence.  As such in the previous example, the updated <kbd>alpha.png</kbd> replaces both the original <kbd>alpha.png</kbd> and <kbd>beta.png</kbd> images, before being saved as <kbd>gamma.png</kbd>.</p>

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


<p>The value escape <kbd>%[fx: ]</kbd> is evaluated once only for each image in the current image sequence, with <kbd>s</kbd> and <kbd>t</kbd> specifying which image is being referred to <kbd>i</kbd> and <kbd>j</kbd> is set to zero and the current channel is set to red (<a href="../www/command-line-options.html#channel" target="magick-options">-channel</a> is ignored).</p>

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


</div>

<div id="linkbar">
 <!--    <span id="linkbar-west">&nbsp;</span>  -->
    <span id="linkbar-center">
      <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;
      <a href="../www/mailing-list.html">Mailing Lists</a> &bull;
      <a href="http://cafe.imagemagick.org">Cafe</a> &bull;
    <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>
    </span>
    <span id="linkbar-east">&nbsp;</span>
  </div>
  <div class="footer">
    <span id="footer-west">&copy; 1999-2009 ImageMagick Studio LLC</span>
    <span id="footer-east"> <a href="http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>
  </div>
  <div style="clear: both; margin: 0; width: 100%; "></div>
</body>
</html>

Man Man