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