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