]> granicus.if.org Git - imagemagick/blob - www/compose.html
(no commit message)
[imagemagick] / www / compose.html
1 \r
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" \r
3   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
4 <html version="-//W3C//DTD XHTML 1.1//EN"\r
5       xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"\r
6       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
7       xsi:schemaLocation="http://www.w3.org/1999/xhtml\r
8                           http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">\r
9 <head>\r
10   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>\r
11   <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U="/>\r
12   <title>ImageMagick: Alpha Compositing</title>
13   <meta http-equiv="Content-Language" content="en-US"/>
14   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
15   <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/>
16   <meta name="Application-name" content="ImageMagick"/>
17   <meta name="Description" content="Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats.  In addition resize, rotate, shear, distort and transform images."/>
18   <meta name="Application-url" content="http://www.imagemagick.org"/>
19   <meta name="Generator" content="PHP"/>
20   <meta name="Keywords" content="alpha, compositing, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing"/>
21   <meta name="Rating" content="GENERAL"/>
22   <meta name="Robots" content="INDEX, FOLLOW"/>
23   <meta name="Generator" content="ImageMagick Studio LLC"/>
24   <meta name="Author" content="ImageMagick Studio LLC"/>
25   <meta name="Revisit-after" content="2 DAYS"/>
26   <meta name="Resource-type" content="document"/>
27   <meta name="Copyright" content="Copyright (c) 1999-2011 ImageMagick Studio LLC"/>
28   <meta name="Distribution" content="Global"/>
29   <link rel="icon" href="../images/wand.png"/>
30   <link rel="shortcut icon" href="../images/wand.ico"  type="images/x-icon"/>
31   <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>\r
32   <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />\r
33   <style type="text/css" media="all">\r
34     @import url("../www/magick.css");\r
35   </style>\r
36   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>\r
37   <script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"></script>\r
38   <link rel="stylesheet" type="text/css" href="../fancybox/jquery.fancybox-1.3.4.css" media="screen" />\r
39   <script type="text/javascript">\r
40     $(document).ready(function() {\r
41       $("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({\r
42         'transitionIn'  : 'elastic',\r
43         'transitionOut' : 'elastic',\r
44         'overlayShow'   : false,\r
45         'opacity'       : true\r
46       });\r
47     });\r
48   </script>\r
49 </head>\r
50 \r
51 <body id="www-imagemagick-org">\r
52 <div class="titlebar">\r
53 <a href="../index.html">\r
54   <img src="../images/script.png" alt="[ImageMagick]"\r
55   style="width: 350px; height: 60px; margin: 28px auto; float: left;" /></a>\r
56 <a href="http://www.networkredux.com">\r
57   <img src="../images/networkredux.png" alt="[sponsor]"\r
58   style="margin-top: 42px; border: 0px; float: left;" /></a>\r
59 <a href="http://www.imagemagick.org/discourse-server/">\r
60   <img src="../images/logo.jpg"\r
61   alt="ImageMagick Logo"\r
62   style="width: 123px; height: 118px; border: 0px; float: right;" /></a>\r
63 <a href="../index.html">\r
64   <img src="../images/sprite.jpg"\r
65   alt="ImageMagick Sprite"\r
66   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>\r
67 </div>\r
68 \r
69 <div class="westbar">\r
70 \r
71 <div class="menu">
72   <a title="About ImageMagick" href="../index.html">About ImageMagick</a>
73 </div>
74 <div class="sep"></div>\r
75 <div class="menu">
76   <a title="Binary Releases" href="../www/binary-releases.html">Binary Releases</a>
77 </div>
78 <div class="sub">
79     <a title="Binary Release: Unix" href="../www/binary-releases.html#unix">Unix</a>
80 </div>
81 <div class="sub">
82     <a title="Binary Release: MacOS X" href="../www/binary-releases.html#macosx">Mac OS X</a>
83 </div>
84 <div class="sub">
85     <a title="Binary Release: iPhone" href="../www/binary-releases.html#iPhone">iPhone</a>
86 </div>
87 <div class="sub">
88     <a title="Binary Release: Windows" href="../www/binary-releases.html#windows">Windows</a>
89 </div>
90 <div class="sep"></div>\r
91 <div class="menu">
92   <a title="Command-line Tools" href="../www/command-line-tools.html">Command-line Tools</a>
93 </div>
94 <div class="sub">
95     <a title="Command-line Tools: Processing" href="../www/command-line-processing.html">Processing</a>
96 </div>
97 <div class="sub">
98     <a title="Command-line Tools: Options" href="../www/command-line-options.html">Options</a>
99 </div>
100 <div class="sub">
101     <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
102 </div>
103 <div class="menu">
104   <a title="Program Interfaces" href="../www/api.html">Program Interfaces</a>
105 </div>
106 <div class="sub">
107     <a title="Program Interface: MagickWand" href="../www/magick-wand.html">MagickWand</a>
108 </div>
109 <div class="sub">
110     <a title="Program Interface: MagickCore" href="../www/magick-core.html">MagickCore</a>
111 </div>
112 <div class="sub">
113     <a title="Program Interface: PerlMagick" href="../www/perl-magick.html">PerlMagick</a>
114 </div>
115 <div class="sub">
116     <a title="Program Interface: Magick++" href="../www/magick++.html">Magick++</a>
117 </div>
118 <div class="sep"></div>\r
119 <div  class="menu">
120    <a title="Install from Source" href="../www/install-source.html">Install from Source</a>
121 </div>
122 <div class="sub">
123     <a title="Install from Source: Unix" href="../www/install-source.html#unix">Unix</a>
124 </div>
125 <div class="sub">
126     <a title="Install from Source: Windows" href="../www/install-source.html#windows">Windows</a>
127  </div>
128 <div class="menu">
129   <a title="Resources" href="../www/resources.html">Resources</a>
130 </div>
131 <div class="menu">
132   <a title="Architecture" href="../www/architecture.html">Architecture</a>
133 </div>
134 <div class="menu">
135   <a title="Download" href="../www/download.html">Download</a>
136 </div>
137 <div class="sep"></div>\r
138 <div class="menu">
139   <a title="Search" href="../www/search.html">Search</a>
140 </div>
141 <div class="sep"></div>\r
142 <div class="menu">
143   <a title="Site Map" href="../www/sitemap.html">Site Map</a>
144 </div>
145 <div  class="sub">
146   <a title="Site Map: Links" href="../www/links.html">Links</a>
147 </div>
148 <div class="sep"></div>\r
149 <div  class="menu">
150   <a title="Sponsors" href="../www/sponsors.html">Sponsors:</a>
151
152 <div class="sponsbox">
153 <div  class="sponsor">
154   <a title="Sponsor: Website Hosting" href="http://hostreviewgeeks.com">Website Hosting</a><!-- 201106010090 alexanian media -->
155 </div>
156 <div  class="sponsor">
157   <a title="Sponsor: Druckerei" href="http://www.allesdruck.de">Druckerei</a><!-- 201107010240 r.leo -->
158 </div>
159 <div  class="sponsor">
160   <a title="Sponsor: Best Web Hosting" href="http://webhostinggeeks.com">Best Web Hosting</a><!-- 201110010720 -->
161 </div>
162 <div  class="sponsor">
163   <a title="Sponsor: Image Converter" href="http://www.batchphoto.com">Image Converter</a><!-- 201103010900 Bits Coffee-->
164 </div>
165 <div  class="sponsor">
166   <a title="Sponsor: Web Hosting Ratings" href="http://webhostingrating.com">Web Hosting Ratings</a><!-- 201110010720 -->
167 </div>
168 <div  class="sponsor">
169   <a title="Sponsor: Flyer drucken" href="http://www.online-druck.biz">Flyer drucken</a><!-- 201109010900 Floeter-->
170 </div>
171 <div class="sponsor">
172   <a title="Sponsor: Web Hosting" href="http://www.bodhost.com/hosting.shtml">Web Hosting</a><!-- 201104010090 -->
173 </div>
174 <div  class="sponsor">
175   <a title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 201110010720 -->
176 </div>
177 <div  class="sponsor">
178    <a title="Sponsor: alaTest.com" href="http://alatest.com">alaTest.com</a><!-- 20110801000300 -->
179 </div>
180 </div>
181 </div>
182 </div>\r
183 \r
184 <div class="eastbar">\r
185   <script type="text/javascript">\r
186   <!--\r
187     google_ad_client = "pub-3129977114552745";\r
188     google_ad_slot = "0574824969";\r
189     google_ad_width = 160;\r
190     google_ad_height = 600;\r
191   //-->\r
192   </script>\r
193   <script type="text/javascript"\r
194     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\r
195   </script>\r
196 </div>\r
197 \r
198 <div class="main">\r
199 \r
200 <h1>ImageMagick Image Composition</h1>
201 <p>This page descibed the Image composition methods that is used to define how
202 two images should be merged together in various image operations.  For the
203 Command Line API it is typically set using the <A
204 HREF="../www/command-line-options.html#compose" >-compose</A> setting option. </p>
205
206
207 <p>The description of composition uses abstract terminology in order to allow
208 the description to be more precise, while avoiding constant values which are
209 specific to a particular build configuration. Each image pixel is represented
210 by red, green, and blue levels (which are equal for a gray pixel). The
211 build-dependent value <em class="QR">QuantumRange</em> is the maximum integral
212 value which may be stored, per pixel, in the red, green, or blue channels of
213 the image. Each image pixel may also optionally (if the image matte channel is
214 enabled) have an associated level of opacity, ranging from <em>opaque</em> to
215 <em>transparent</em>, which may be used to determine the influence of the pixel
216 color when compositing the pixel with another image pixel. If the image matte
217 channel is disabled, then all pixels in the image are treated as opaque. The
218 color of an opaque pixel is fully visible while the color of a transparent
219 pixel color is entirely absent (pixel color is ignored).</p>
220
221 <p>By definition, raster images have a rectangular shape. All image rows are of
222 equal length, as are all image columns. By treating the alpha channel as a
223 visual "mask" the rectangular image may be given a "shape" by treating the
224 alpha channel as a cookie-cutter for the image. This is done by setting the
225 pixels within the shape to be opaque, with pixels outside the shape set as
226 transparent. Pixels on the boundary of the shape may be between opaque and
227 transparent in order to provide antialiasing (visually smooth edges). The
228 description of the composition operators use this concept of image "shape" in
229 order to make the description of the operators easier to understand. While it
230 is convenient to describe the operators in terms of "shapes" they are by no
231 means limited to mask-style operations since they are based on continuous
232 floating-point mathematics rather than simple boolean operations.</p>
233
234 <p>The following alpha blending (Duff-Porter) compose methods are available:</p>
235
236 <table class="doc">
237   <tbody>
238   <tr valign="top">
239     <th align="left" style="width: 8%">Method</th>
240     <th align="left">Description</th>
241   </tr>
242
243   <tr valign="top">
244     <td valign="top">clear</td>
245     <td valign="top">Both the color and the alpha of the destination are
246         cleared. Neither the source nor the destination are used (except for
247         destinations size and other meta-data which is always preserved.</td>
248   </tr>
249
250   <tr valign="top">
251     <td valign="top">src</td>
252     <td valign="top">The source is copied to the destination. The destination
253         is not used as input, though it is cleared.</td>
254   </tr>
255
256   <tr valign="top">
257     <td valign="top">dst</td>
258     <td valign="top">The destination is left untouched. The source image is
259         completely ignored.</td>
260   </tr>
261
262   <tr valign="top">
263     <td valign="top">src-over</td>
264     <td valign="top">The source is composited over the destination. this is
265        the default alpha blending compose method, when neither the compose
266        setting is set, nor is set in the image meta-data.</td>
267   </tr>
268
269   <tr valign="top">
270     <td valign="top">dst-over</td>
271     <td valign="top">The destination is composited over the source and the
272         result replaces the destination.</td>
273   </tr>
274
275   <tr valign="top">
276     <td valign="top">src-in</td>
277     <td valign="top">The part of the source lying inside of the destination
278         replaces the destination.</td>
279   </tr>
280
281   <tr valign="top">
282     <td valign="top">dst-in</td>
283     <td valign="top">The part of the destination lying inside of the source
284         replaces the destination. Areas not overlaid are cleared.</td>
285   </tr>
286
287   <tr valign="top">
288     <td valign="top">src-out</td>
289     <td valign="top">The part of the source lying outside of the destination
290         replaces the destination.</td>
291   </tr>
292
293   <tr valign="top">
294     <td valign="top">dst-out</td>
295     <td valign="top">The part of the destination lying outside of the source
296         replaces the destination.</td>
297   </tr>
298
299   <tr valign="top">
300     <td valign="top">src-atop</td>
301     <td valign="top">The part of the source lying inside of the destination is
302         composited onto the destination.</td>
303   </tr>
304
305   <tr valign="top">
306     <td valign="top">dst-atop</td>
307     <td valign="top">The part of the destination lying inside of the source is
308         composited over the source and replaces the destination. Areas not
309         overlaid are cleared. </td>
310   </tr>
311
312   <tr valign="top">
313     <td valign="top">xor</td>
314     <td valign="top">The part of the source that lies outside of the
315         destination is combined with the part of the destination that lies
316         outside of the source.  Source or Destination, but not both. </td>
317   </tr>
318
319   </tbody>
320 </table>
321
322 <p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
323 For example the default compose method can be specified as just 'Over'.</p>
324
325 <p>Many of these compose methods will clear the destination image which was
326 not overlaid by the source image.  This is to be expected as part of that
327 specific composition methods defintion. You can disable this by setting the
328 special <A HREF="../www/command-line-options.html#define"
329 >-define</A> 'compose:outside-overlay' to a value of 'false' will turn off
330 this behaviour. </p>
331
332 <p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
333 related method '<kbd>Copy</kbd>' has been provided. This is equivelent to
334 using the '<kbd>Src</kbd>'  with the special <A HREF="../www/command-line-options.html#define"
335 >-define</A> option '<kbd>compose:outside-overlay</kbd>' set to
336 '<kbd>false</kbd>', so as to only modify the overlaid area, without clearing
337 the rest of the image outside the overlaid area.  </p>
338
339 <br><br>
340
341 <p>The following mathemathical composition methods are also available. </p>
342
343 <table class="doc">
344   <tbody>
345   <tr valign="top">
346     <th align="left" style="width: 8%">Method</th>
347     <th align="left">Description</th>
348   </tr>
349
350   <tr valign="top">
351     <td valign="top">multiply</td>
352     <td valign="top">The source is multiplied by the destination and replaces
353         the destination. The resultant color is always at least as dark as
354         either of the two constituent colors. Multiplying any color with black
355         produces black. Multiplying any color with white leaves the original
356         color unchanged.</td>
357   </tr>
358
359   <tr valign="top">
360     <td valign="top">screen</td>
361     <td valign="top">The source and destination are complemented and then
362         multiplied and then replace the destination. The resultant color is
363         always at least as light as either of the two constituent colors.
364         Screening any color with white produces white. Screening any color
365         with black leaves the original color unchanged.</td>
366   </tr>
367
368   <tr valign="top">
369     <td valign="top">plus</td>
370     <td valign="top">The source is added to the destination and replaces the
371         destination. This operator is useful for averaging or a controled
372         merger of two images, rather than a direct overlay.</td>
373   </tr>
374
375   <tr valign="top">
376     <td valign="top">add</td>
377     <td valign="top">As per 'plus' but transparency data is treated as matte
378         values. As such any transparent areas in either image remain
379         transparent. </td>
380   </tr>
381
382   <tr valign="top">
383     <td valign="top">minus</td>
384     <td valign="top">Subtract the colors in the source image from the
385         destination image. When transparency is involved, opaque areas is
386         subtracted from any destination opaque areas. </td>
387   </tr>
388
389   <tr valign="top">
390     <td valign="top">subtract</td>
391     <td valign="top">Subtract the colors in the source image from the
392         destination image. When transparency is involved transparent areas are
393         subtracted, so only the opaque areas in the source remain opaque in
394         the destination image. </td>
395   </tr>
396
397   <tr valign="top">
398     <td valign="top">difference</td>
399     <td valign="top">Subtracts the darker of the two constituent colors from
400         the lighter. Painting with white inverts the destination color.
401         Painting with black produces no change.</td>
402   </tr>
403
404   <tr valign="top">
405     <td valign="top">exclusion</td>
406     <td valign="top">Produces an effect similar to that of 'difference', but
407         appears as lower contrast.  Painting with white inverts the
408         destination color. Painting with black produces no change.</td>
409   </tr>
410
411   <tr valign="top">
412     <td valign="top">darken</td>
413     <td valign="top">Selects the darker of the destination and source colors.
414         The destination is replaced with the source when the source is darker,
415         otherwise it is left unchanged.</td>
416   </tr>
417
418   <tr valign="top">
419     <td valign="top">lighten</td>
420     <td valign="top">Selects the lighter of the destination and source colors.
421         The destination is replaced with the source when the source is
422         lighter, otherwise it is left unchanged. </td>
423   </tr>
424
425   </tbody>
426 </table>
427
428 <p>Typically these use the default 'Over' alpha blending when transparencies
429 are also involved, except for 'Plus' which uses a 'plus' alpha blending.  This
430 means the alpha channel  of both images will only be used to ensure that any
431 visible input remains visible even in parts not overlaid. It also means that
432 any values are weighted by the alpha channel of the input and output images.
433 This 'Over' alpha blending is also applied to the lighting composition methods
434 below. </p>
435
436 <p>As of IM v6.6.1-6, if the special '<kbd>Sync</kbd>' flag is not specified
437 (enabled by default) with the <a href="../www/command-line-options.html#channel"
438 >-channel</a> setting, then the above mathematical compositions will nolonger
439 syncronise its actions with the alpha channel.  Instead the math composition
440 will be applied on an individual channel basis as defined by the <a
441 href="../www/command-line-options.html#channel"
442 >-channel</a>.  This includes the alpha channel. This special usage
443 allows you to perform true mathematics of the image channels, without alpha
444 compostion effects, becomming involved. </p>
445
446 <p>This special flag is not applied to the lighting composition methods (see
447 below) even though they are closely related to mathematical composition
448 methods.</p>
449
450 <br><br>
451
452 <p>The following lighting composition methods are also available. </p>
453
454 <table class="doc">
455   <tbody>
456   <tr valign="top">
457     <th align="left" style="width: 8%">Method</th>
458     <th align="left">Description</th>
459   </tr>
460
461   <tr valign="top">
462     <td valign="top">linear-dodge</td>
463     <td valign="top">This is equivelent to 'Plus' in that the color channels
464         are simply added, however it does not 'Plus' the alpha channel, but
465         uses the normal 'Over' alpha blending, which transparencies are
466         involved.  Produces a sort of additive multiply-like result. Added
467         ImageMagick version 6.5.4-3. </td>
468   </tr>
469
470   <tr valign="top">
471     <td valign="top">linear-burn</td>
472     <td valign="top">As 'Linear-Dodge', but also subtract one from the result.
473         Sort of a additive 'Screen' of the images.  Added ImageMagick version
474         6.5.4-3. </td>
475   </tr>
476
477   <tr valign="top">
478     <td valign="top">color-dodge</td>
479     <td valign="top">Brightens the destination color to reflect the source
480         color. Painting with black produces no change.</td>
481   </tr>
482
483   <tr valign="top">
484     <td valign="top">color-burn</td>
485     <td valign="top">Darkens the destination color to reflect the source
486         color.  Painting with white produces no change. Fixed in ImageMagick
487         version 6.5.4-3. </td>
488   </tr>
489
490   <tr valign="top">
491     <td valign="top">overlay</td>
492     <td valign="top">Multiplies or screens the colors, dependent on the
493         destination color. Source colors overlay the destination whilst
494         preserving its highlights and shadows. The destination color is not
495         replaced, but is mixed with the source color to reflect the lightness
496         or darkness of the destination.</td>
497   </tr>
498
499   <tr valign="top">
500     <td valign="top">hard-light</td>
501     <td valign="top">Multiplies or screens the colors, dependent on the source
502         color value. If the source color is lighter than 0.5, the destination
503         is lightened as if it were screened. If the source color is darker
504         than 0.5, the destination is darkened, as if it were multiplied. The
505         degree of lightening or darkening is proportional to the difference
506         between the source color and 0.5. If it is equal to 0.5 the
507         destination is unchanged.  Painting with pure black or white produces
508         black or white.</td>
509   </tr>
510
511
512   <tr valign="top">
513     <td valign="top">linear-light</td>
514     <td valign="top">Like 'Hard-Light' but using linear-dodge and linear-burn
515         instead.  Increases contrast slightly with an impact on the
516         foreground's tonal values.</td>
517   </tr>
518
519   <tr valign="top">
520     <td valign="top">soft-light</td>
521     <td valign="top">Darkens or lightens the colors, dependent on the source
522         color value. If the source color is lighter than 0.5, the destination
523         is lightened. If the source color is darker than 0.5, the destination
524         is darkened, as if it were burned in. The degree of darkening or
525         lightening is proportional to the difference between the source color
526         and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
527         with pure black or white produces a distinctly darker or lighter area,
528         but does not result in pure black or white. Fixed in ImageMagick
529         version 6.5.4-3. </td>
530   </tr>
531
532   <tr valign="top">
533     <td valign="top">pegtop-light</td>
534     <td valign="top">Almost equivelent to 'Soft-Light', but using a
535         continuious mathematical formula rather than two conditionally
536         selected formulae. Added ImageMagick version 6.5.4-3. </td>
537   </tr>
538
539   <tr valign="top">
540     <td valign="top">vivid-light</td>
541     <td valign="top">A modified 'Linear-Light' designed to preserve very stong
542         primary and secondary colors in the image. Added ImageMagick version
543         6.5.4-3. </td>
544   </tr>
545
546   <tr valign="top">
547     <td valign="top">pin-light</td>
548     <td valign="top">Similar to 'Hard-Light', but using sharp linear shadings,
549         to similate the effects of a strong 'pinhole' light source. Added
550         ImageMagick version 6.5.4-3. </td>
551   </tr>
552
553   </tbody>
554 </table>
555
556
557 <br><br>
558
559 <p>Also included are these special purpose compose methods:</p>
560
561 <table class="doc">
562   <tbody>
563   <tr valign="top">
564     <th align="left" style="width: 8%">Method</th>
565     <th align="left">Description</th>
566   </tr>
567
568   <tr valign="top">
569     <td valign="top">copy</td>
570     <td valign="top">This is equivelent to the Duff-Porter composition method
571         '<kbd>Src,</kbd>' but without clearing the parts of the destination
572         image that is not overlaid.  </td>
573     </tr>
574
575   <tr valign="top">
576     <td valign="top">copy-*</td>
577     <td valign="top">Copy the specified channel (Red, Green, Blue, Cyan,
578         Magenta, Yellow, Black, or Opacity) in the source image to the
579         same channel in the destination image.  If the channel specified
580         does not exist in the source image, (which can only happen for methods,
581         '<kbd>copy-opacity</kbd>' or '<kbd>copy-black</kbd>') then it is
582         assumed that the source image is a special grayscale channel image
583         of the values that is to be copied. </td>
584     </tr>
585
586   <tr valign="top">
587     <td valign="top">change-mask</td>
588     <td valign="top">Replace any destination pixel that is the similar to the
589     source images pixel (as defined by the current <a
590     href="../www/command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
591     </td>
592   </tr>
593   </tbody>
594 </table>
595
596 <br><br>
597
598 <p>On top of these composed methods are a few special ones that not only require
599 the two images that are being merged or overlaid, but have some extra numerical
600 arguments, which are tabled below. </p>
601
602 <p>In the "<code>composite</code>" command these composition methods are
603 selected using special options with the arguments needed. They are usually,
604 but not always, the same name as the composte 'method' they use, and replaces
605 the normal use of the <a href="../www/command-line-options.html#compose" >-compose</a>
606 setting in the "<code>composite</code>" command.  For example... </p>
607
608 <p class='crt'><span class="crtprompt"> $magick&gt; </span><span class='crtin'>composite ... -blend 50x50 ...</span></p>
609 <p>As of IM v6.5.3-4 the "<code>convert</code>" command can now also supply
610 these extra arguments to its <a href="../www/command-line-options.html#composite"
611 >-composite</a> operator, using the special <a href="../www/command-line-options.html#define">-define</a>
612 attribute of '<kbd class="arg">compose:args</kbd>'.  This means you can now
613 make use of these special argumented <a href="../www/command-line-options.html#compose"
614 >-compose</a> methods, those the argument and the method both need to be set
615 separatally.  For example... </p>
616
617 <p class='crt'><span class="crtprompt"> $magick&gt; </span><span class='crtin'>convert ... -compose blend  -define compose:args=50,50 -composite ...</span></p>
618 <p>The following is a table of these special 'argumented' compose methods,
619 with a brief summary of what they do. For more details see the equivalent
620 "composite" command option name.  </p>
621
622 <table class="doc">
623   <tbody>
624   <tr valign="top">
625     <th align="left" style="width: 8%">Method</th>
626     <th align="left">Description</th>
627   </tr>
628
629   <tr valign="top">
630     <td valign="top">dissolve</td>
631     <td valign="top">Arguments:
632         <em class="arg">src_percent</em>[x<em class="arg">dst_percent</em>]
633     <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#dissolve">-dissolve</a>
634     <br>Dissolve the 'source' image by the percentage given before overlaying
635         'over' the 'destination' image. If <em class="arg">src_percent</em> is
636         greater than 100, it starts dissolving the main image so it will
637         become transparent at a value of '<kbd class="arg">200</kbd>'.  If
638         both percentages are given, each image are dissolved to the
639         percentages given.
640     </td>
641   </tr>
642
643   <tr valign="top">
644     <td valign="top">blend</td>
645     <td valign="top">Arguments:
646         <em class="arg">src_percent</em>[x<em class="arg">dst_percent</em>]
647     <br>Equivalent to "<code>composite</code>" <a
648         href="../www/command-line-options.html#blend">-blend</a>
649     <br>Average the images together ('plus') according to the percentages
650         given and each pixels transparency.  If only a single percentage value
651         is given it sets the weight of the composite or 'source' image, while
652         the background image is weighted by the exact opposite amount. That is
653         a <kbd>-blend 30</kbd> merges 30% of the 'source' image with 70% of
654         the 'destination' image.  Thus it is equivalent to <kbd>-blend
655         30x70</kbd>.
656     </td>
657   </tr>
658
659   <tr valign="top">
660     <td valign="top">mathematics</td>
661     <td valign="top">Arguments: <em class="arg">A, B, C, D</em>
662     <br>Not available in "<code>composite</code>" at this time.
663     <br>Merge the source and destination images according to the formula
664     <br>&nbsp; &nbsp; &nbsp;<code>A*Sc*Dc + B*Sc + C*Dc + D</code>
665     <br>Can be used to generate a custom composition method that would
666         otherwise need to be implemented using the slow <a
667         href="../www/command-line-options.html#fx">-fx</a> DIY image operator.   Added
668         to ImageMagick version 6.5.4-3.
669     <br>As of IM v6.6.1-6 this method will do per-channel math compositions
670         if the 'Sync' flag is removed from <a
671         href="../www/command-line-options.html#channel" >-channel</a>, just like all
672         the other mathematical compostion methods above.
673     </td>
674   </tr>
675
676   <tr valign="top">
677     <td valign="top">modulate</td>
678     <td valign="top">Arguments:
679         <em class="arg">brightness</em>[x<em class="arg">saturation</em>]
680     <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#watermark">-watermark</a>
681     <br>Take a grayscale image (with alpha mask) and modify the destination
682         image's brightness according to watermark image's grayscale value and
683         the <em class="arg">brightness</em> percentage.  The destinations
684         color saturation attribute is just direct modified by the <em
685         class="arg">saturation</em> percentage, which defaults to 100 percent
686         (no color change).
687
688     </td>
689   </tr>
690
691   <tr valign="top">
692     <td valign="top">displace</td>
693     <td valign="top">Arguments:
694         <em class="arg">X-scale</em>[x<em class="arg">Y-scale</em>][!][%]
695     <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#displace">-displace</a>
696     <br>With this option, the 'overlay' image, and optionally the 'mask'
697         image, is used as a relative displacement map, which is used to
698         displace the lookup of what part of the destination image is seen at
699         each point of the overlaid area.  Much like the displacement map is a
700         'lens' that distorts the original 'background' image behind it.
701     <br><br>
702         The X-scale is modilated by the 'red' channel of the overlay image
703         while the Y-scale is modulated by the green channel, (the mask image
704         if given is rolled into green channel of the overlay image. This
705         separation allows you to modulate the X and Y lookup displacement
706         separatally allowing you to di 2 dimentional displacements, rather
707         than 1 dimentional verctored displacements (using grayscale image).
708     <br><br>
709         If the overlay image contains transparency this is used as a mask
710         of the resulting image to remove 'invalid' pixels.
711     <br><br>
712         The '%' flag makes the displacement scale relative to the size of the
713         overlay image (100% = half width/height of image). Using '!' switches
714         percentage arguments to refer to the destination image size instead.
715     <br><br>
716         Special flags were added Added to ImageMagick version 6.5.3-5.
717     </td>
718   </tr>
719
720   <tr valign="top">
721     <td valign="top">distort</td>
722     <td valign="top">Arguments:
723         <em class="arg">X-scale</em>[x<em class="arg">Y-scale</em
724         >[+<em class="arg">X-center</em>+<em class="arg">Y-center</em>]][!][%]
725     <br>Not available in "<code>composite</code>" at this time.
726     <br>Exactly as per 'Displace' (above), but using absolute coordinates,
727         relative to the center of the overlay (or that given).  Basically
728         allows you to generate absolute distortion maps where 'black' will
729         look up the left/top edge, and 'white' looks up the bottom/right
730         edge of the destination image, according to the scale given.
731     <br><br>
732         The '!' flag not only switches percentage scaling, to use the
733         destination image, but also the image the center offset of the lookup.
734         This means the overlay can lookup a completely different region of the
735         destination image.
736     <br><br>
737         Added to ImageMagick version 6.5.3-5.
738     </td>
739   </tr>
740
741   <tr valign="top">
742     <td valign="top">blur</td>
743     <td valign="top">Arguments:
744         <em class="arg">Width</em>[x<em class="arg">Height</em
745           >[+<em class="arg">Angle</em>][+<em class="arg">Angle2</em>]]
746     <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#blur-composite">-blur</a>
747     <br>A Variable Blur Mapping Composition method, where each pixel in the
748         overlaid region is replaced with an Elliptical Weighted Average (EWA),
749         with an ellipse (typically a circle) of the given sigma size, scaled
750         according to overlay (source image) grayscale mapping.
751     <br><br>
752         As per 'Displace' and 'Distort', the red channel will modulate the
753         width of the ellipse, while the green channel will modulate the height
754         of the ellipse. If a single Angle value is given in the arguments,
755         then the ellipse will then be rotated by the angle specifed.
756     <br><br>
757         Normally the blue channel of the mapping overlay image is ignored.
758         However if a second ellipse angle is given, then it is assumed that
759         the blue channel defines a variable angle for the ellipse ranging from
760         the first angle to the second angle given.  This allows to generate
761         radial blurs, or a rough approximation for rotational blur. Or any mix
762         of the two.
763     <br><br>
764         Added to ImageMagick version 6.5.4-0.
765     </td>
766   </tr>
767
768   </tbody>
769 </table>
770
771 <p>To print a complete list of all the available compose operators, use <a
772 href="../www/command-line-options.html#list">-list compose</a>.</p>
773
774
775 \r
776 </div>\r
777 \r
778 <div id="linkbar">\r
779     <span id="linkbar-west">&nbsp;</span>\r
780     <span id="linkbar-center">\r
781       <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;\r
782       <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>\r
783     </span>\r
784     <span id="linkbar-east">&nbsp;</span>\r
785   </div>\r
786   <div class="footer">\r
787     <span id="footer-west">&copy; 1999-2011 ImageMagick Studio LLC</span>\r
788     <span id="footer-east"> <a href="http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>\r
789   </div>\r
790   <div style="clear: both; margin: 0; width: 100%; "></div>\r
791   <script type="text/javascript">\r
792     var _gaq = _gaq || [];\r
793     _gaq.push(['_setAccount', 'UA-17690367-1']);\r
794     _gaq.push(['_trackPageview']);\r
795 \r
796     (function() {\r
797       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
798       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
799       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
800     })();\r
801   </script>\r
802 </body>\r
803 </html>\r