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