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