blob: a7c0922f7977f905884c878d32e1413ab35845ad [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">
cristy2bd2a982011-02-15 00:52:58 +00004<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">
cristybc9539a2010-08-16 18:06:20 +00009<head>
10 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
11 <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U="/>
cristydcca3fa2010-12-29 21:50:07 +000012 <title>ImageMagick: Alpha Compositing</title>
cristybc9539a2010-08-16 18:06:20 +000013 <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"/>
cristye6e84152011-06-06 14:16:49 +000017 <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."/>
cristybc9539a2010-08-16 18:06:20 +000018 <meta name="Application-url" content="http://www.imagemagick.org"/>
19 <meta name="Generator" content="PHP"/>
cristye6e84152011-06-06 14:16:49 +000020 <meta name="Keywords" content="alpha, compositing, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Image, Processing, Automagically"/>
cristybc9539a2010-08-16 18:06:20 +000021 <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"/>
cristy7e41fe82010-12-04 23:12:08 +000027 <meta name="Copyright" content="Copyright (c) 1999-2011 ImageMagick Studio LLC"/>
cristybc9539a2010-08-16 18:06:20 +000028 <meta name="Distribution" content="Global"/>
cristydcca3fa2010-12-29 21:50:07 +000029 <link rel="icon" href="../images/wand.png"/>
cristybc9539a2010-08-16 18:06:20 +000030 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon"/>
31 <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
cristy7a40ba82011-01-08 20:31:18 +000032 <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
cristybc9539a2010-08-16 18:06:20 +000033 <style type="text/css" media="all">
34 @import url("../www/magick.css");
35 </style>
cristydcca3fa2010-12-29 21:50:07 +000036 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
cristy361f4662010-12-31 23:02:52 +000037 <script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"></script>
38 <link rel="stylesheet" type="text/css" href="../fancybox/jquery.fancybox-1.3.4.css" media="screen" />
39 <script type="text/javascript">
40 $(document).ready(function() {
41 $("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({
42 'transitionIn' : 'elastic',
43 'transitionOut' : 'elastic',
44 'overlayShow' : false,
45 'opacity' : true
46 });
47 });
48 </script>
cristybc9539a2010-08-16 18:06:20 +000049</head>
50
51<body id="www-imagemagick-org">
52<div class="titlebar">
cristyb52981c2011-03-19 17:09:31 +000053<div style="margin: 17px auto; float: left;">
54 <script type="text/javascript">
55 <!--
56 google_ad_client = "pub-3129977114552745";
57 google_ad_slot = "5439289906";
58 google_ad_width = 728;
59 google_ad_height = 90;
60 //-->
61 </script>
62 <script type="text/javascript"
63 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
64 </script>
65</div>
cristybc9539a2010-08-16 18:06:20 +000066<a href="http://www.imagemagick.org/discourse-server/">
cristyaf8d6652011-02-04 21:57:45 +000067 <img src="../images/logo.jpg"
68 alt="ImageMagick Logo"
cristy178edaf2011-01-23 03:42:39 +000069 style="width: 123px; height: 118px; border: 0px; float: right;" /></a>
cristybc9539a2010-08-16 18:06:20 +000070<a href="../index.html">
cristyaf8d6652011-02-04 21:57:45 +000071 <img src="../images/sprite.jpg"
72 alt="ImageMagick Sprite"
cristybc9539a2010-08-16 18:06:20 +000073 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
74</div>
75
76<div class="westbar">
77
78<div class="menu">
79 <a title="About ImageMagick" href="../index.html">About ImageMagick</a>
80</div>
81<div class="sep"></div>
82<div class="menu">
83 <a title="Binary Releases" href="../www/binary-releases.html">Binary Releases</a>
84</div>
85<div class="sub">
86 <a title="Binary Release: Unix" href="../www/binary-releases.html#unix">Unix</a>
87</div>
88<div class="sub">
89 <a title="Binary Release: MacOS X" href="../www/binary-releases.html#macosx">Mac OS X</a>
90</div>
91<div class="sub">
cristye6e84152011-06-06 14:16:49 +000092 <a title="Binary Release: iOS" href="../www/binary-releases.html#iOS">iOS</a>
cristyda16f162011-02-19 23:52:17 +000093</div>
94<div class="sub">
cristybc9539a2010-08-16 18:06:20 +000095 <a title="Binary Release: Windows" href="../www/binary-releases.html#windows">Windows</a>
96</div>
97<div class="sep"></div>
98<div class="menu">
99 <a title="Command-line Tools" href="../www/command-line-tools.html">Command-line Tools</a>
100</div>
101<div class="sub">
102 <a title="Command-line Tools: Processing" href="../www/command-line-processing.html">Processing</a>
103</div>
104<div class="sub">
105 <a title="Command-line Tools: Options" href="../www/command-line-options.html">Options</a>
106</div>
107<div class="sub">
108 <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
109</div>
110<div class="menu">
111 <a title="Program Interfaces" href="../www/api.html">Program Interfaces</a>
112</div>
113<div class="sub">
114 <a title="Program Interface: MagickWand" href="../www/magick-wand.html">MagickWand</a>
115</div>
116<div class="sub">
117 <a title="Program Interface: MagickCore" href="../www/magick-core.html">MagickCore</a>
118</div>
119<div class="sub">
120 <a title="Program Interface: PerlMagick" href="../www/perl-magick.html">PerlMagick</a>
121</div>
122<div class="sub">
cristydcca3fa2010-12-29 21:50:07 +0000123 <a title="Program Interface: Magick++" href="../www/magick++.html">Magick++</a>
cristybc9539a2010-08-16 18:06:20 +0000124</div>
125<div class="sep"></div>
126<div class="menu">
127 <a title="Install from Source" href="../www/install-source.html">Install from Source</a>
128</div>
129<div class="sub">
130 <a title="Install from Source: Unix" href="../www/install-source.html#unix">Unix</a>
131</div>
132<div class="sub">
133 <a title="Install from Source: Windows" href="../www/install-source.html#windows">Windows</a>
134 </div>
135<div class="menu">
136 <a title="Resources" href="../www/resources.html">Resources</a>
137</div>
138<div class="menu">
139 <a title="Architecture" href="../www/architecture.html">Architecture</a>
140</div>
141<div class="menu">
142 <a title="Download" href="../www/download.html">Download</a>
143</div>
144<div class="sep"></div>
145<div class="menu">
cristy52923442011-01-15 22:54:31 +0000146 <a title="Search" href="../www/search.html">Search</a>
cristybc9539a2010-08-16 18:06:20 +0000147</div>
148<div class="sep"></div>
149<div class="menu">
cristydcca3fa2010-12-29 21:50:07 +0000150 <a title="Site Map" href="../www/sitemap.html">Site Map</a>
cristybc9539a2010-08-16 18:06:20 +0000151</div>
152<div class="sub">
cristydcca3fa2010-12-29 21:50:07 +0000153 <a title="Site Map: Links" href="../www/links.html">Links</a>
cristybc9539a2010-08-16 18:06:20 +0000154</div>
155<div class="sep"></div>
156<div class="menu">
cristy10549a12011-05-15 19:04:46 +0000157 <a rel="follow" title="Sponsors" href="../www/sponsors.html">Sponsors:</a>
cristybc9539a2010-08-16 18:06:20 +0000158
cristyb52981c2011-03-19 17:09:31 +0000159<a href="http://www.networkredux.com">
160 <img src="../images/networkredux.png" alt="[sponsor]"
161 style="margin-top: 4px; margin-left: 4px; border: 0px; float: left;" /></a>
cristybc9539a2010-08-16 18:06:20 +0000162<div class="sponsbox">
cristy178edaf2011-01-23 03:42:39 +0000163<div class="sponsor">
cristy81492d62011-06-07 16:41:42 +0000164 <a rel="follow" title="Sponsor: Web Hosting" href="http://www.micfo.com">Web Hosting</a><!-- 209901010090s golestan -->
165</div>
166<div class="sponsor">
167 <a rel="follow" title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 201110010720 -->
168</div>
169<div class="sponsor">
cristyba1758d2011-06-03 01:29:12 +0000170 <a rel="follow" title="Sponsor: Web Hosting Deals" href="http://www.webhostingdeals.org">Web Hosting Deals</a><!-- 201111010270 chee.hoa darin -->
171</div>
172<div class="sponsor">
173 <a rel="follow" title="Sponsor: Web Hosting Reviews" href="http://www.webhostingsecretrevealed.com">Web Hosting Secret Revealed</a><!-- 201204010540 iamchee jerry -->
174</div>
175<div class="sponsor">
cristy4bf6e232011-05-21 01:43:33 +0000176 <a rel="follow" title="Sponsor: Web Hosting Break" href="http://www.webhostingbreak.com">Web Hosting Break</a><!-- 201109010090 ian@ian-m... -->
cristy45dbd322011-03-27 16:40:38 +0000177</div>
178<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000179 <a rel="follow" title="Sponsor: Druckerei" href="http://www.allesdruck.de">Druckerei</a><!-- 201303011500 r.leo -->
cristy4c54bbb2011-03-17 13:53:13 +0000180</div>
181<div class="sponsor">
cristy575d5ee2011-05-24 01:59:01 +0000182 <a rel="follow" title="Sponsor: Website Hosting" href="http://www.hostreviewgeeks.com">Website Hosting</a><!-- 201110010090 alexanian media -->
cristy4bf6e232011-05-21 01:43:33 +0000183</div>
184<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000185 <a rel="follow" title="Sponsor: Hotel München" href="http://www.messehotel-erb-muenchen.de">Hotel München</a><!-- 201111010450 cerb -->
cristyaf8d6652011-02-04 21:57:45 +0000186</div>
187<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000188 <a rel="follow" title="Sponsor: Best Web Hosting" href="http://webhostinggeeks.com">Best Web Hosting</a><!-- 201110010720 -->
cristy7d52cd62010-10-01 17:26:59 +0000189</div>
190<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000191 <a rel="follow" title="Sponsor: Flyer drucken" href="http://www.online-druck.biz">Flyer drucken</a><!-- 201109010900 Floeter-->
cristyee742642011-02-26 02:49:59 +0000192</div>
193<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000194 <a rel="follow" title="Sponsor: Web Hosting Reviews" href="http://www.webhostingmasters.com">Web Hosting Reviews</a><!-- 201107011500 affliatelabel -->
cristybc9539a2010-08-16 18:06:20 +0000195</div>
cristyec6b4752011-01-08 03:16:23 +0000196<div class="sponsor">
cristy10549a12011-05-15 19:04:46 +0000197 <a rel="follow" title="Sponsor: Web Hosting Ratings" href="http://webhostingrating.com">Web Hosting Ratings</a><!-- 201110010720 -->
cristybaacd172011-04-30 23:11:03 +0000198</div>
199<div class="sponsor">
cristy2dcd6822011-06-13 16:21:20 +0000200 <a rel="follow" title="Kaffeevollautomaten Reparatur Kundendienst Berlin" href="http://www.kaffeemaschinen-center.de">Kaffeevollautomaten Reparatur Berlin</a><!-- 2011090100025 c.karule-->
cristyec6b4752011-01-08 03:16:23 +0000201</div>
cristybc9539a2010-08-16 18:06:20 +0000202</div>
203</div>
204</div>
205
206<div class="eastbar">
cristyb52981c2011-03-19 17:09:31 +0000207
cristybc9539a2010-08-16 18:06:20 +0000208</div>
209
210<div class="main">
211
cristydcca3fa2010-12-29 21:50:07 +0000212<h1>ImageMagick Image Composition</h1>
cristyabd337d2010-08-17 01:06:59 +0000213<p>This page descibed the Image composition methods that is used to define how
214two images should be merged together in various image operations. For the
215Command Line API it is typically set using the <A
216HREF="../www/command-line-options.html#compose" >-compose</A> setting option. </p>
217
218
cristybc9539a2010-08-16 18:06:20 +0000219<p>The description of composition uses abstract terminology in order to allow
220the description to be more precise, while avoiding constant values which are
221specific to a particular build configuration. Each image pixel is represented
222by red, green, and blue levels (which are equal for a gray pixel). The
223build-dependent value <em class="QR">QuantumRange</em> is the maximum integral
224value which may be stored, per pixel, in the red, green, or blue channels of
225the image. Each image pixel may also optionally (if the image matte channel is
226enabled) have an associated level of opacity, ranging from <em>opaque</em> to
227<em>transparent</em>, which may be used to determine the influence of the pixel
228color when compositing the pixel with another image pixel. If the image matte
229channel is disabled, then all pixels in the image are treated as opaque. The
230color of an opaque pixel is fully visible while the color of a transparent
231pixel color is entirely absent (pixel color is ignored).</p>
232
233<p>By definition, raster images have a rectangular shape. All image rows are of
234equal length, as are all image columns. By treating the alpha channel as a
235visual "mask" the rectangular image may be given a "shape" by treating the
236alpha channel as a cookie-cutter for the image. This is done by setting the
237pixels within the shape to be opaque, with pixels outside the shape set as
238transparent. Pixels on the boundary of the shape may be between opaque and
239transparent in order to provide antialiasing (visually smooth edges). The
240description of the composition operators use this concept of image "shape" in
241order to make the description of the operators easier to understand. While it
242is convenient to describe the operators in terms of "shapes" they are by no
243means limited to mask-style operations since they are based on continuous
244floating-point mathematics rather than simple boolean operations.</p>
245
246<p>The following alpha blending (Duff-Porter) compose methods are available:</p>
247
248<table class="doc">
249 <tbody>
250 <tr valign="top">
251 <th align="left" style="width: 8%">Method</th>
252 <th align="left">Description</th>
253 </tr>
254
255 <tr valign="top">
256 <td valign="top">clear</td>
257 <td valign="top">Both the color and the alpha of the destination are
258 cleared. Neither the source nor the destination are used (except for
259 destinations size and other meta-data which is always preserved.</td>
260 </tr>
261
262 <tr valign="top">
263 <td valign="top">src</td>
264 <td valign="top">The source is copied to the destination. The destination
265 is not used as input, though it is cleared.</td>
266 </tr>
267
268 <tr valign="top">
269 <td valign="top">dst</td>
270 <td valign="top">The destination is left untouched. The source image is
271 completely ignored.</td>
272 </tr>
273
274 <tr valign="top">
275 <td valign="top">src-over</td>
276 <td valign="top">The source is composited over the destination. this is
277 the default alpha blending compose method, when neither the compose
278 setting is set, nor is set in the image meta-data.</td>
279 </tr>
280
281 <tr valign="top">
282 <td valign="top">dst-over</td>
283 <td valign="top">The destination is composited over the source and the
284 result replaces the destination.</td>
285 </tr>
286
287 <tr valign="top">
288 <td valign="top">src-in</td>
289 <td valign="top">The part of the source lying inside of the destination
290 replaces the destination.</td>
291 </tr>
292
293 <tr valign="top">
294 <td valign="top">dst-in</td>
295 <td valign="top">The part of the destination lying inside of the source
296 replaces the destination. Areas not overlaid are cleared.</td>
297 </tr>
298
299 <tr valign="top">
300 <td valign="top">src-out</td>
301 <td valign="top">The part of the source lying outside of the destination
302 replaces the destination.</td>
303 </tr>
304
305 <tr valign="top">
306 <td valign="top">dst-out</td>
307 <td valign="top">The part of the destination lying outside of the source
308 replaces the destination.</td>
309 </tr>
310
311 <tr valign="top">
312 <td valign="top">src-atop</td>
313 <td valign="top">The part of the source lying inside of the destination is
314 composited onto the destination.</td>
315 </tr>
316
317 <tr valign="top">
318 <td valign="top">dst-atop</td>
319 <td valign="top">The part of the destination lying inside of the source is
320 composited over the source and replaces the destination. Areas not
321 overlaid are cleared. </td>
322 </tr>
323
324 <tr valign="top">
325 <td valign="top">xor</td>
326 <td valign="top">The part of the source that lies outside of the
327 destination is combined with the part of the destination that lies
328 outside of the source. Source or Destination, but not both. </td>
329 </tr>
330
331 </tbody>
332</table>
333
334<p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
cristyabd337d2010-08-17 01:06:59 +0000335For example the default compose method can be specified as just 'Over'.</p>
cristybc9539a2010-08-16 18:06:20 +0000336
cristyabd337d2010-08-17 01:06:59 +0000337<p>Many of these compose methods will clear the destination image which was
338not overlaid by the source image. This is to be expected as part of that
cristy075ad252010-10-30 21:56:17 +0000339specific composition methods defintion. You can disable this by setting the
340special <A HREF="../www/command-line-options.html#define"
341>-define</A> 'compose:outside-overlay' to a value of 'false' will turn off
342this behaviour. </p>
cristyabd337d2010-08-17 01:06:59 +0000343
344<p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
cristybaacd172011-04-30 23:11:03 +0000345related method '<kbd>Copy</kbd>' has been provided. This is equivalent to
cristy075ad252010-10-30 21:56:17 +0000346using the '<kbd>Src</kbd>' with the special <A HREF="../www/command-line-options.html#define"
347>-define</A> option '<kbd>compose:outside-overlay</kbd>' set to
348'<kbd>false</kbd>', so as to only modify the overlaid area, without clearing
349the rest of the image outside the overlaid area. </p>
cristyabd337d2010-08-17 01:06:59 +0000350
351<br><br>
cristybc9539a2010-08-16 18:06:20 +0000352
353<p>The following mathemathical composition methods are also available. </p>
354
355<table class="doc">
356 <tbody>
357 <tr valign="top">
358 <th align="left" style="width: 8%">Method</th>
359 <th align="left">Description</th>
360 </tr>
361
362 <tr valign="top">
363 <td valign="top">multiply</td>
364 <td valign="top">The source is multiplied by the destination and replaces
365 the destination. The resultant color is always at least as dark as
366 either of the two constituent colors. Multiplying any color with black
367 produces black. Multiplying any color with white leaves the original
368 color unchanged.</td>
369 </tr>
370
371 <tr valign="top">
372 <td valign="top">screen</td>
373 <td valign="top">The source and destination are complemented and then
374 multiplied and then replace the destination. The resultant color is
375 always at least as light as either of the two constituent colors.
376 Screening any color with white produces white. Screening any color
377 with black leaves the original color unchanged.</td>
378 </tr>
379
380 <tr valign="top">
381 <td valign="top">plus</td>
382 <td valign="top">The source is added to the destination and replaces the
383 destination. This operator is useful for averaging or a controled
384 merger of two images, rather than a direct overlay.</td>
385 </tr>
386
387 <tr valign="top">
388 <td valign="top">add</td>
389 <td valign="top">As per 'plus' but transparency data is treated as matte
390 values. As such any transparent areas in either image remain
391 transparent. </td>
392 </tr>
393
394 <tr valign="top">
395 <td valign="top">minus</td>
396 <td valign="top">Subtract the colors in the source image from the
397 destination image. When transparency is involved, opaque areas is
398 subtracted from any destination opaque areas. </td>
399 </tr>
400
401 <tr valign="top">
402 <td valign="top">subtract</td>
403 <td valign="top">Subtract the colors in the source image from the
404 destination image. When transparency is involved transparent areas are
405 subtracted, so only the opaque areas in the source remain opaque in
406 the destination image. </td>
407 </tr>
408
409 <tr valign="top">
410 <td valign="top">difference</td>
411 <td valign="top">Subtracts the darker of the two constituent colors from
412 the lighter. Painting with white inverts the destination color.
413 Painting with black produces no change.</td>
414 </tr>
415
416 <tr valign="top">
417 <td valign="top">exclusion</td>
418 <td valign="top">Produces an effect similar to that of 'difference', but
419 appears as lower contrast. Painting with white inverts the
420 destination color. Painting with black produces no change.</td>
421 </tr>
422
423 <tr valign="top">
424 <td valign="top">darken</td>
425 <td valign="top">Selects the darker of the destination and source colors.
426 The destination is replaced with the source when the source is darker,
427 otherwise it is left unchanged.</td>
428 </tr>
429
430 <tr valign="top">
431 <td valign="top">lighten</td>
432 <td valign="top">Selects the lighter of the destination and source colors.
433 The destination is replaced with the source when the source is
434 lighter, otherwise it is left unchanged. </td>
435 </tr>
436
437 </tbody>
438</table>
439
440<p>Typically these use the default 'Over' alpha blending when transparencies
cristyabd337d2010-08-17 01:06:59 +0000441are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
442means the alpha channel of both images will only be used to ensure that any
443visible input remains visible even in parts not overlaid. It also means that
444any values are weighted by the alpha channel of the input and output images.
445This 'Over' alpha blending is also applied to the lighting composition methods
446below. </p>
cristybc9539a2010-08-16 18:06:20 +0000447
448<p>As of IM v6.6.1-6, if the special '<kbd>Sync</kbd>' flag is not specified
cristyabd337d2010-08-17 01:06:59 +0000449(enabled by default) with the <a href="../www/command-line-options.html#channel"
450>-channel</a> setting, then the above mathematical compositions will nolonger
cristy2dcd6822011-06-13 16:21:20 +0000451synchronise its actions with the alpha channel. Instead the math composition
cristyabd337d2010-08-17 01:06:59 +0000452will be applied on an individual channel basis as defined by the <a
453href="../www/command-line-options.html#channel"
454>-channel</a>. This includes the alpha channel. This special usage
455allows you to perform true mathematics of the image channels, without alpha
456compostion effects, becomming involved. </p>
cristybc9539a2010-08-16 18:06:20 +0000457
cristyabd337d2010-08-17 01:06:59 +0000458<p>This special flag is not applied to the lighting composition methods (see
459below) even though they are closely related to mathematical composition
460methods.</p>
cristybc9539a2010-08-16 18:06:20 +0000461
cristyabd337d2010-08-17 01:06:59 +0000462<br><br>
cristybc9539a2010-08-16 18:06:20 +0000463
464<p>The following lighting composition methods are also available. </p>
465
466<table class="doc">
467 <tbody>
468 <tr valign="top">
469 <th align="left" style="width: 8%">Method</th>
470 <th align="left">Description</th>
471 </tr>
472
473 <tr valign="top">
474 <td valign="top">linear-dodge</td>
cristybaacd172011-04-30 23:11:03 +0000475 <td valign="top">This is equivalent to 'Plus' in that the color channels
cristybc9539a2010-08-16 18:06:20 +0000476 are simply added, however it does not 'Plus' the alpha channel, but
477 uses the normal 'Over' alpha blending, which transparencies are
478 involved. Produces a sort of additive multiply-like result. Added
479 ImageMagick version 6.5.4-3. </td>
480 </tr>
481
482 <tr valign="top">
483 <td valign="top">linear-burn</td>
484 <td valign="top">As 'Linear-Dodge', but also subtract one from the result.
485 Sort of a additive 'Screen' of the images. Added ImageMagick version
486 6.5.4-3. </td>
487 </tr>
488
489 <tr valign="top">
490 <td valign="top">color-dodge</td>
491 <td valign="top">Brightens the destination color to reflect the source
492 color. Painting with black produces no change.</td>
493 </tr>
494
495 <tr valign="top">
496 <td valign="top">color-burn</td>
497 <td valign="top">Darkens the destination color to reflect the source
498 color. Painting with white produces no change. Fixed in ImageMagick
499 version 6.5.4-3. </td>
500 </tr>
501
502 <tr valign="top">
503 <td valign="top">overlay</td>
504 <td valign="top">Multiplies or screens the colors, dependent on the
505 destination color. Source colors overlay the destination whilst
506 preserving its highlights and shadows. The destination color is not
507 replaced, but is mixed with the source color to reflect the lightness
508 or darkness of the destination.</td>
509 </tr>
510
511 <tr valign="top">
512 <td valign="top">hard-light</td>
513 <td valign="top">Multiplies or screens the colors, dependent on the source
514 color value. If the source color is lighter than 0.5, the destination
515 is lightened as if it were screened. If the source color is darker
516 than 0.5, the destination is darkened, as if it were multiplied. The
517 degree of lightening or darkening is proportional to the difference
518 between the source color and 0.5. If it is equal to 0.5 the
519 destination is unchanged. Painting with pure black or white produces
520 black or white.</td>
521 </tr>
522
523
524 <tr valign="top">
525 <td valign="top">linear-light</td>
526 <td valign="top">Like 'Hard-Light' but using linear-dodge and linear-burn
527 instead. Increases contrast slightly with an impact on the
528 foreground's tonal values.</td>
529 </tr>
530
531 <tr valign="top">
532 <td valign="top">soft-light</td>
533 <td valign="top">Darkens or lightens the colors, dependent on the source
534 color value. If the source color is lighter than 0.5, the destination
535 is lightened. If the source color is darker than 0.5, the destination
536 is darkened, as if it were burned in. The degree of darkening or
537 lightening is proportional to the difference between the source color
538 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
539 with pure black or white produces a distinctly darker or lighter area,
540 but does not result in pure black or white. Fixed in ImageMagick
541 version 6.5.4-3. </td>
542 </tr>
543
544 <tr valign="top">
545 <td valign="top">pegtop-light</td>
cristybaacd172011-04-30 23:11:03 +0000546 <td valign="top">Almost equivalent to 'Soft-Light', but using a
cristybc9539a2010-08-16 18:06:20 +0000547 continuious mathematical formula rather than two conditionally
548 selected formulae. Added ImageMagick version 6.5.4-3. </td>
549 </tr>
550
551 <tr valign="top">
552 <td valign="top">vivid-light</td>
553 <td valign="top">A modified 'Linear-Light' designed to preserve very stong
554 primary and secondary colors in the image. Added ImageMagick version
555 6.5.4-3. </td>
556 </tr>
557
558 <tr valign="top">
559 <td valign="top">pin-light</td>
560 <td valign="top">Similar to 'Hard-Light', but using sharp linear shadings,
561 to similate the effects of a strong 'pinhole' light source. Added
562 ImageMagick version 6.5.4-3. </td>
563 </tr>
564
565 </tbody>
566</table>
567
568
cristyabd337d2010-08-17 01:06:59 +0000569<br><br>
cristybc9539a2010-08-16 18:06:20 +0000570
571<p>Also included are these special purpose compose methods:</p>
572
573<table class="doc">
574 <tbody>
575 <tr valign="top">
576 <th align="left" style="width: 8%">Method</th>
577 <th align="left">Description</th>
578 </tr>
579
580 <tr valign="top">
cristyabd337d2010-08-17 01:06:59 +0000581 <td valign="top">copy</td>
cristybaacd172011-04-30 23:11:03 +0000582 <td valign="top">This is equivalent to the Duff-Porter composition method
cristy075ad252010-10-30 21:56:17 +0000583 '<kbd>Src,</kbd>' but without clearing the parts of the destination
cristyabd337d2010-08-17 01:06:59 +0000584 image that is not overlaid. </td>
585 </tr>
586
587 <tr valign="top">
cristybc9539a2010-08-16 18:06:20 +0000588 <td valign="top">copy-*</td>
589 <td valign="top">Copy the specified channel (Red, Green, Blue, Cyan,
590 Magenta, Yellow, Black, or Opacity) in the source image to the
591 same channel in the destination image. If the channel specified
592 does not exist in the source image, (which can only happen for methods,
593 '<kbd>copy-opacity</kbd>' or '<kbd>copy-black</kbd>') then it is
594 assumed that the source image is a special grayscale channel image
cristy075ad252010-10-30 21:56:17 +0000595 of the values that is to be copied. </td>
cristybc9539a2010-08-16 18:06:20 +0000596 </tr>
597
598 <tr valign="top">
599 <td valign="top">change-mask</td>
cristyabd337d2010-08-17 01:06:59 +0000600 <td valign="top">Replace any destination pixel that is the similar to the
601 source images pixel (as defined by the current <a
602 href="../www/command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
603 </td>
cristybc9539a2010-08-16 18:06:20 +0000604 </tr>
605 </tbody>
606</table>
607
cristyabd337d2010-08-17 01:06:59 +0000608<br><br>
609
cristybc9539a2010-08-16 18:06:20 +0000610<p>On top of these composed methods are a few special ones that not only require
611the two images that are being merged or overlaid, but have some extra numerical
612arguments, which are tabled below. </p>
613
614<p>In the "<code>composite</code>" command these composition methods are
615selected using special options with the arguments needed. They are usually,
616but not always, the same name as the composte 'method' they use, and replaces
cristyabd337d2010-08-17 01:06:59 +0000617the normal use of the <a href="../www/command-line-options.html#compose" >-compose</a>
618setting in the "<code>composite</code>" command. For example... </p>
cristybc9539a2010-08-16 18:06:20 +0000619
620<p class='crt'><span class="crtprompt"> $magick&gt; </span><span class='crtin'>composite ... -blend 50x50 ...</span></p>
621<p>As of IM v6.5.3-4 the "<code>convert</code>" command can now also supply
cristyabd337d2010-08-17 01:06:59 +0000622these extra arguments to its <a href="../www/command-line-options.html#composite"
cristy075ad252010-10-30 21:56:17 +0000623>-composite</a> operator, using the special <a href="../www/command-line-options.html#define">-define</a>
624attribute of '<kbd class="arg">compose:args</kbd>'. This means you can now
625make use of these special argumented <a href="../www/command-line-options.html#compose"
cristyabd337d2010-08-17 01:06:59 +0000626>-compose</a> methods, those the argument and the method both need to be set
627separatally. For example... </p>
cristybc9539a2010-08-16 18:06:20 +0000628
cristy075ad252010-10-30 21:56:17 +0000629<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 +0000630<p>The following is a table of these special 'argumented' compose methods,
631with a brief summary of what they do. For more details see the equivalent
632"composite" command option name. </p>
633
634<table class="doc">
635 <tbody>
636 <tr valign="top">
637 <th align="left" style="width: 8%">Method</th>
638 <th align="left">Description</th>
639 </tr>
640
641 <tr valign="top">
642 <td valign="top">dissolve</td>
643 <td valign="top">Arguments:
644 <em class="arg">src_percent</em>[x<em class="arg">dst_percent</em>]
cristyabd337d2010-08-17 01:06:59 +0000645 <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#dissolve">-dissolve</a>
cristybc9539a2010-08-16 18:06:20 +0000646 <br>Dissolve the 'source' image by the percentage given before overlaying
647 'over' the 'destination' image. If <em class="arg">src_percent</em> is
648 greater than 100, it starts dissolving the main image so it will
649 become transparent at a value of '<kbd class="arg">200</kbd>'. If
650 both percentages are given, each image are dissolved to the
651 percentages given.
652 </td>
653 </tr>
654
655 <tr valign="top">
656 <td valign="top">blend</td>
657 <td valign="top">Arguments:
658 <em class="arg">src_percent</em>[x<em class="arg">dst_percent</em>]
cristyabd337d2010-08-17 01:06:59 +0000659 <br>Equivalent to "<code>composite</code>" <a
660 href="../www/command-line-options.html#blend">-blend</a>
cristybc9539a2010-08-16 18:06:20 +0000661 <br>Average the images together ('plus') according to the percentages
662 given and each pixels transparency. If only a single percentage value
663 is given it sets the weight of the composite or 'source' image, while
664 the background image is weighted by the exact opposite amount. That is
665 a <kbd>-blend 30</kbd> merges 30% of the 'source' image with 70% of
666 the 'destination' image. Thus it is equivalent to <kbd>-blend
667 30x70</kbd>.
668 </td>
669 </tr>
670
671 <tr valign="top">
672 <td valign="top">mathematics</td>
673 <td valign="top">Arguments: <em class="arg">A, B, C, D</em>
674 <br>Not available in "<code>composite</code>" at this time.
675 <br>Merge the source and destination images according to the formula
676 <br>&nbsp; &nbsp; &nbsp;<code>A*Sc*Dc + B*Sc + C*Dc + D</code>
677 <br>Can be used to generate a custom composition method that would
cristyabd337d2010-08-17 01:06:59 +0000678 otherwise need to be implemented using the slow <a
679 href="../www/command-line-options.html#fx">-fx</a> DIY image operator. Added
680 to ImageMagick version 6.5.4-3.
cristybc9539a2010-08-16 18:06:20 +0000681 <br>As of IM v6.6.1-6 this method will do per-channel math compositions
cristyabd337d2010-08-17 01:06:59 +0000682 if the 'Sync' flag is removed from <a
683 href="../www/command-line-options.html#channel" >-channel</a>, just like all
684 the other mathematical compostion methods above.
cristybc9539a2010-08-16 18:06:20 +0000685 </td>
686 </tr>
687
688 <tr valign="top">
689 <td valign="top">modulate</td>
690 <td valign="top">Arguments:
691 <em class="arg">brightness</em>[x<em class="arg">saturation</em>]
cristyabd337d2010-08-17 01:06:59 +0000692 <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#watermark">-watermark</a>
cristybc9539a2010-08-16 18:06:20 +0000693 <br>Take a grayscale image (with alpha mask) and modify the destination
694 image's brightness according to watermark image's grayscale value and
695 the <em class="arg">brightness</em> percentage. The destinations
696 color saturation attribute is just direct modified by the <em
697 class="arg">saturation</em> percentage, which defaults to 100 percent
698 (no color change).
699
700 </td>
701 </tr>
702
703 <tr valign="top">
704 <td valign="top">displace</td>
705 <td valign="top">Arguments:
706 <em class="arg">X-scale</em>[x<em class="arg">Y-scale</em>][!][%]
cristyabd337d2010-08-17 01:06:59 +0000707 <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#displace">-displace</a>
cristybc9539a2010-08-16 18:06:20 +0000708 <br>With this option, the 'overlay' image, and optionally the 'mask'
709 image, is used as a relative displacement map, which is used to
710 displace the lookup of what part of the destination image is seen at
711 each point of the overlaid area. Much like the displacement map is a
712 'lens' that distorts the original 'background' image behind it.
713 <br><br>
714 The X-scale is modilated by the 'red' channel of the overlay image
715 while the Y-scale is modulated by the green channel, (the mask image
716 if given is rolled into green channel of the overlay image. This
717 separation allows you to modulate the X and Y lookup displacement
718 separatally allowing you to di 2 dimentional displacements, rather
719 than 1 dimentional verctored displacements (using grayscale image).
720 <br><br>
721 If the overlay image contains transparency this is used as a mask
722 of the resulting image to remove 'invalid' pixels.
723 <br><br>
724 The '%' flag makes the displacement scale relative to the size of the
725 overlay image (100% = half width/height of image). Using '!' switches
726 percentage arguments to refer to the destination image size instead.
727 <br><br>
728 Special flags were added Added to ImageMagick version 6.5.3-5.
729 </td>
730 </tr>
731
732 <tr valign="top">
733 <td valign="top">distort</td>
734 <td valign="top">Arguments:
735 <em class="arg">X-scale</em>[x<em class="arg">Y-scale</em
736 >[+<em class="arg">X-center</em>+<em class="arg">Y-center</em>]][!][%]
737 <br>Not available in "<code>composite</code>" at this time.
738 <br>Exactly as per 'Displace' (above), but using absolute coordinates,
739 relative to the center of the overlay (or that given). Basically
740 allows you to generate absolute distortion maps where 'black' will
741 look up the left/top edge, and 'white' looks up the bottom/right
742 edge of the destination image, according to the scale given.
743 <br><br>
744 The '!' flag not only switches percentage scaling, to use the
745 destination image, but also the image the center offset of the lookup.
746 This means the overlay can lookup a completely different region of the
747 destination image.
748 <br><br>
749 Added to ImageMagick version 6.5.3-5.
750 </td>
751 </tr>
752
753 <tr valign="top">
754 <td valign="top">blur</td>
755 <td valign="top">Arguments:
756 <em class="arg">Width</em>[x<em class="arg">Height</em
cristy075ad252010-10-30 21:56:17 +0000757 >[+<em class="arg">Angle</em>][+<em class="arg">Angle2</em>]]
cristyabd337d2010-08-17 01:06:59 +0000758 <br>Equivalent to "<code>composite</code>" <a href="../www/command-line-options.html#blur-composite">-blur</a>
cristybc9539a2010-08-16 18:06:20 +0000759 <br>A Variable Blur Mapping Composition method, where each pixel in the
760 overlaid region is replaced with an Elliptical Weighted Average (EWA),
761 with an ellipse (typically a circle) of the given sigma size, scaled
762 according to overlay (source image) grayscale mapping.
763 <br><br>
764 As per 'Displace' and 'Distort', the red channel will modulate the
765 width of the ellipse, while the green channel will modulate the height
cristy075ad252010-10-30 21:56:17 +0000766 of the ellipse. If a single Angle value is given in the arguments,
767 then the ellipse will then be rotated by the angle specifed.
768 <br><br>
769 Normally the blue channel of the mapping overlay image is ignored.
770 However if a second ellipse angle is given, then it is assumed that
771 the blue channel defines a variable angle for the ellipse ranging from
772 the first angle to the second angle given. This allows to generate
773 radial blurs, or a rough approximation for rotational blur. Or any mix
774 of the two.
cristybc9539a2010-08-16 18:06:20 +0000775 <br><br>
776 Added to ImageMagick version 6.5.4-0.
777 </td>
778 </tr>
779
780 </tbody>
781</table>
782
783<p>To print a complete list of all the available compose operators, use <a
cristyabd337d2010-08-17 01:06:59 +0000784href="../www/command-line-options.html#list">-list compose</a>.</p>
cristybc9539a2010-08-16 18:06:20 +0000785
786
787
788</div>
789
790<div id="linkbar">
791 <span id="linkbar-west">&nbsp;</span>
792 <span id="linkbar-center">
793 <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;
794 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>
795 </span>
796 <span id="linkbar-east">&nbsp;</span>
797 </div>
798 <div class="footer">
cristy7e41fe82010-12-04 23:12:08 +0000799 <span id="footer-west">&copy; 1999-2011 ImageMagick Studio LLC</span>
cristybc9539a2010-08-16 18:06:20 +0000800 <span id="footer-east"> <a href="http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>
801 </div>
802 <div style="clear: both; margin: 0; width: 100%; "></div>
803 <script type="text/javascript">
804 var _gaq = _gaq || [];
805 _gaq.push(['_setAccount', 'UA-17690367-1']);
806 _gaq.push(['_trackPageview']);
807
808 (function() {
809 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
810 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
811 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
812 })();
813 </script>
814</body>
815</html>