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