blob: dadb23081739edf2a1feee999af447e97cf80476 [file] [log] [blame]
Cristy594d2772015-11-15 10:47:42 -05001
2
3
4
cristy29dc8652015-05-12 16:26:21 +00005<!DOCTYPE html>
cristyd2432012015-05-04 23:15:15 +00006<html lang="en">
cristyad41c0c2012-10-31 00:49:28 +00007<head>
Cristy4666f5a2017-12-15 20:35:01 -05008 <meta charset="utf-8" />
Cristyd8420112021-01-01 14:52:00 -05009 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
Cristy15efeaa2019-11-28 09:22:08 -050010 <title>ImageMagick - Alpha Compositing</title>
Cristy4666f5a2017-12-15 20:35:01 -050011 <meta name="application-name" content="ImageMagick" />
Cristy15efeaa2019-11-28 09:22:08 -050012 <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." />
Cristya2276362018-09-09 10:28:40 -040013 <meta name="application-url" content="https://imagemagick.org" />
Cristy4666f5a2017-12-15 20:35:01 -050014 <meta name="generator" content="PHP" />
Cristy8d6f6382020-03-19 18:36:11 -040015 <meta name="keywords" content="alpha, compositing, image converter, image resizer, image editor, photo editor, jpg converter, png converter, tiff converter, vector images, online, free, swiss army" />
Cristy4666f5a2017-12-15 20:35:01 -050016 <meta name="rating" content="GENERAL" />
17 <meta name="robots" content="INDEX, FOLLOW" />
18 <meta name="generator" content="ImageMagick Studio LLC" />
19 <meta name="author" content="ImageMagick Studio LLC" />
20 <meta name="revisit-after" content="2 DAYS" />
21 <meta name="resource-type" content="document" />
Cristyf775a5c2019-11-26 14:27:47 -050022 <meta name="copyright" content="Copyright (c) 1999-2020 ImageMagick Studio LLC" />
Cristy4666f5a2017-12-15 20:35:01 -050023 <meta name="distribution" content="Global" />
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
Cristy15efeaa2019-11-28 09:22:08 -050025 <meta property='og:url' content='../' />
26 <meta property='og:title' content='ImageMagick' />
27 <meta property='og:image' content='../images/logo.png' />
28 <meta property='og:type' content='website' />
29 <meta property='og:site_name' content='ImageMagick' />
Cristy8d6f6382020-03-19 18:36:11 -040030 <meta property='og:description' content="Create, Edit, Compose, or Convert Bitmap Images" />
Cristy4666f5a2017-12-15 20:35:01 -050031 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
32 <link href="compose.html" rel="canonical" />
33 <link href="../images/wand.png" rel="icon" />
34 <link href="../images/wand.ico" rel="shortcut icon" />
35 <link href="assets/magick.css" rel="stylesheet" />
cristyad41c0c2012-10-31 00:49:28 +000036</head>
cristyd2432012015-05-04 23:15:15 +000037<body>
Cristyfae1b182019-01-05 11:47:43 -050038 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
Cristyc253f2f2020-06-12 19:17:20 -040039 <a class="navbar-brand" href="../index.html"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
Cristyfae1b182019-01-05 11:47:43 -050040 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
Cristya2276362018-09-09 10:28:40 -040041 <span class="navbar-toggler-icon"></span>
Cristy13afdf02017-12-08 12:19:49 -050042 </button>
43
Cristyfae1b182019-01-05 11:47:43 -050044 <div class="navbar-collapse collapse" id="navbarsMagick" style="">
Cristy13afdf02017-12-08 12:19:49 -050045 <ul class="navbar-nav mr-auto">
46 <li class="nav-item ">
Cristyc253f2f2020-06-12 19:17:20 -040047 <a class="nav-link" href="../index.html">Home <span class="sr-only">(current)</span></a>
Cristy13afdf02017-12-08 12:19:49 -050048 </li>
49 <li class="nav-item ">
Cristyc253f2f2020-06-12 19:17:20 -040050 <a class="nav-link" href="download.html">Download</a>
Cristy13afdf02017-12-08 12:19:49 -050051 </li>
52 <li class="nav-item ">
Cristyc253f2f2020-06-12 19:17:20 -040053 <a class="nav-link" href="command-line-tools.html">Tools</a>
Cristy13afdf02017-12-08 12:19:49 -050054 </li>
55 <li class="nav-item ">
Cristyc253f2f2020-06-12 19:17:20 -040056 <a class="nav-link" href="command-line-processing.html">Command-line</a>
Cristy13afdf02017-12-08 12:19:49 -050057 </li>
58 <li class="nav-item ">
Cristyc253f2f2020-06-12 19:17:20 -040059 <a class="nav-link" href="develop.html">Develop</a>
Cristy13afdf02017-12-08 12:19:49 -050060 </li>
61 <li class="nav-item">
Cristyc253f2f2020-06-12 19:17:20 -040062 <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
Cristy13afdf02017-12-08 12:19:49 -050063 </li>
Cristy0e12ff62020-07-30 17:19:08 -040064 <li class="nav-item">
65
66 </li>
67 <li class="nav-item">
68 <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
69 </li>
Cristy13afdf02017-12-08 12:19:49 -050070 </ul>
Cristy917fa782020-02-21 08:50:35 -050071 </div>
Cristyd8420112021-01-01 14:52:00 -050072 <form class="form-inline my-2 my-md-0" action="search.html">
Cristya7050402017-12-16 10:17:49 -050073 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
Cristy8871ec32017-12-31 20:57:02 -050074 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
Cristy13afdf02017-12-08 12:19:49 -050075 </form>
Cristy13afdf02017-12-08 12:19:49 -050076 </nav>
Cristy8fe3d7b2017-12-09 15:53:23 -050077 <div class="container">
78 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle"
79 style="display:block"
80 data-ad-client="ca-pub-3129977114552745"
81 data-ad-slot="6345125851"
Cristy15efeaa2019-11-28 09:22:08 -050082 data-full-width-responsive="true"
83 data-ad-format="horizontal"></ins>
Cristy8fe3d7b2017-12-09 15:53:23 -050084 <script>
85 (adsbygoogle = window.adsbygoogle || []).push({});
86 </script>
Cristya2276362018-09-09 10:28:40 -040087
Cristy8fe3d7b2017-12-09 15:53:23 -050088 </div>
Cristy15efeaa2019-11-28 09:22:08 -050089
Cristy0e12ff62020-07-30 17:19:08 -040090 <main role="main" class="container">
Cristy13afdf02017-12-08 12:19:49 -050091 <div class="magick-template">
cristyd2432012015-05-04 23:15:15 +000092<div class="magick-header">
cristyad41c0c2012-10-31 00:49:28 +000093
cristyd2432012015-05-04 23:15:15 +000094<p class="lead magick-description">This page descibed the Image composition methods that is used to define how
cristyabd337d2010-08-17 01:06:59 +000095two images should be merged together in various image operations. For the
Cristyce4a3552015-12-14 13:53:35 -050096Command Line API it is typically set using the <a
Cristyc253f2f2020-06-12 19:17:20 -040097href="command-line-options.html#compose" >-compose</a> setting option. </p>
cristyabd337d2010-08-17 01:06:59 +000098
99
cristybc9539a2010-08-16 18:06:20 +0000100<p>The description of composition uses abstract terminology in order to allow
101the description to be more precise, while avoiding constant values which are
102specific to a particular build configuration. Each image pixel is represented
103by red, green, and blue levels (which are equal for a gray pixel). The
cristyd2432012015-05-04 23:15:15 +0000104build-dependent value <var>QuantumRange</var> is the maximum integral
cristybc9539a2010-08-16 18:06:20 +0000105value which may be stored, per pixel, in the red, green, or blue channels of
106the image. Each image pixel may also optionally (if the image matte channel is
cristyd2432012015-05-04 23:15:15 +0000107enabled) have an associated level of opacity, ranging from <var>opaque</var> to
108<var>transparent</var>, which may be used to determine the influence of the pixel
cristybc9539a2010-08-16 18:06:20 +0000109color when compositing the pixel with another image pixel. If the image matte
110channel is disabled, then all pixels in the image are treated as opaque. The
111color of an opaque pixel is fully visible while the color of a transparent
112pixel color is entirely absent (pixel color is ignored).</p>
113
114<p>By definition, raster images have a rectangular shape. All image rows are of
115equal length, as are all image columns. By treating the alpha channel as a
116visual "mask" the rectangular image may be given a "shape" by treating the
117alpha channel as a cookie-cutter for the image. This is done by setting the
118pixels within the shape to be opaque, with pixels outside the shape set as
119transparent. Pixels on the boundary of the shape may be between opaque and
120transparent in order to provide antialiasing (visually smooth edges). The
121description of the composition operators use this concept of image "shape" in
122order to make the description of the operators easier to understand. While it
123is convenient to describe the operators in terms of "shapes" they are by no
124means limited to mask-style operations since they are based on continuous
125floating-point mathematics rather than simple boolean operations.</p>
126
127<p>The following alpha blending (Duff-Porter) compose methods are available:</p>
128
Cristy6ed6e582020-09-18 21:47:29 +0000129<table class="table table-sm table-hover">
cristybc9539a2010-08-16 18:06:20 +0000130 <tbody>
cristyd2432012015-05-04 23:15:15 +0000131 <tr>
cristybc9539a2010-08-16 18:06:20 +0000132 <th align="left" style="width: 8%">Method</th>
133 <th align="left">Description</th>
134 </tr>
135
cristyd2432012015-05-04 23:15:15 +0000136 <tr>
137 <td>clear</td>
138 <td>Both the color and the alpha of the destination are
cristybc9539a2010-08-16 18:06:20 +0000139 cleared. Neither the source nor the destination are used (except for
140 destinations size and other meta-data which is always preserved.</td>
141 </tr>
142
cristyd2432012015-05-04 23:15:15 +0000143 <tr>
144 <td>src</td>
145 <td>The source is copied to the destination. The destination
cristybc9539a2010-08-16 18:06:20 +0000146 is not used as input, though it is cleared.</td>
147 </tr>
148
cristyd2432012015-05-04 23:15:15 +0000149 <tr>
150 <td>dst</td>
151 <td>The destination is left untouched. The source image is
cristybc9539a2010-08-16 18:06:20 +0000152 completely ignored.</td>
153 </tr>
154
cristyd2432012015-05-04 23:15:15 +0000155 <tr>
156 <td>src-over</td>
157 <td>The source is composited over the destination. this is
cristybc9539a2010-08-16 18:06:20 +0000158 the default alpha blending compose method, when neither the compose
159 setting is set, nor is set in the image meta-data.</td>
160 </tr>
161
cristyd2432012015-05-04 23:15:15 +0000162 <tr>
163 <td>dst-over</td>
164 <td>The destination is composited over the source and the
cristybc9539a2010-08-16 18:06:20 +0000165 result replaces the destination.</td>
166 </tr>
167
cristyd2432012015-05-04 23:15:15 +0000168 <tr>
169 <td>src-in</td>
170 <td>The part of the source lying inside of the destination
cristybc9539a2010-08-16 18:06:20 +0000171 replaces the destination.</td>
172 </tr>
173
cristyd2432012015-05-04 23:15:15 +0000174 <tr>
175 <td>dst-in</td>
176 <td>The part of the destination lying inside of the source
cristybc9539a2010-08-16 18:06:20 +0000177 replaces the destination. Areas not overlaid are cleared.</td>
178 </tr>
179
cristyd2432012015-05-04 23:15:15 +0000180 <tr>
181 <td>src-out</td>
182 <td>The part of the source lying outside of the destination
cristybc9539a2010-08-16 18:06:20 +0000183 replaces the destination.</td>
184 </tr>
185
cristyd2432012015-05-04 23:15:15 +0000186 <tr>
187 <td>dst-out</td>
188 <td>The part of the destination lying outside of the source
cristybc9539a2010-08-16 18:06:20 +0000189 replaces the destination.</td>
190 </tr>
191
cristyd2432012015-05-04 23:15:15 +0000192 <tr>
193 <td>src-atop</td>
194 <td>The part of the source lying inside of the destination is
cristybc9539a2010-08-16 18:06:20 +0000195 composited onto the destination.</td>
196 </tr>
197
cristyd2432012015-05-04 23:15:15 +0000198 <tr>
199 <td>dst-atop</td>
200 <td>The part of the destination lying inside of the source is
cristybc9539a2010-08-16 18:06:20 +0000201 composited over the source and replaces the destination. Areas not
202 overlaid are cleared. </td>
203 </tr>
204
cristyd2432012015-05-04 23:15:15 +0000205 <tr>
206 <td>xor</td>
207 <td>The part of the source that lies outside of the
cristybc9539a2010-08-16 18:06:20 +0000208 destination is combined with the part of the destination that lies
209 outside of the source. Source or Destination, but not both. </td>
210 </tr>
211
212 </tbody>
213</table>
214
215<p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
cristyabd337d2010-08-17 01:06:59 +0000216For example the default compose method can be specified as just 'Over'.</p>
cristybc9539a2010-08-16 18:06:20 +0000217
cristyabd337d2010-08-17 01:06:59 +0000218<p>Many of these compose methods will clear the destination image which was
219not overlaid by the source image. This is to be expected as part of that
cristy075ad252010-10-30 21:56:17 +0000220specific composition methods defintion. You can disable this by setting the
Cristyc253f2f2020-06-12 19:17:20 -0400221special <a href="command-line-options.html#define"
Cristy594d2772015-11-15 10:47:42 -0500222>-define</a> 'compose:outside-overlay' to a value of 'false' will turn off
Cristy542697a2015-10-12 20:10:32 -0400223this behavior. </p>
cristyabd337d2010-08-17 01:06:59 +0000224
225<p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
cristy8ee7f242013-06-20 16:08:44 +0000226related method '<code>Copy</code>' has been provided. This is equivalent to
Cristyc253f2f2020-06-12 19:17:20 -0400227using the '<code>Src</code>' with the special <a href="command-line-options.html#define"
Cristy594d2772015-11-15 10:47:42 -0500228>-define</a> option '<code>compose:outside-overlay</code>' set to
cristy8ee7f242013-06-20 16:08:44 +0000229'<code>false</code>', so as to only modify the overlaid area, without clearing
cristy075ad252010-10-30 21:56:17 +0000230the rest of the image outside the overlaid area. </p>
cristyabd337d2010-08-17 01:06:59 +0000231
Cristy542697a2015-10-12 20:10:32 -0400232<p>The following mathematical composition methods are also available. </p>
cristybc9539a2010-08-16 18:06:20 +0000233
Cristy6ed6e582020-09-18 21:47:29 +0000234<table class="table table-sm table-hover">
cristybc9539a2010-08-16 18:06:20 +0000235 <tbody>
cristyd2432012015-05-04 23:15:15 +0000236 <tr>
cristybc9539a2010-08-16 18:06:20 +0000237 <th align="left" style="width: 8%">Method</th>
238 <th align="left">Description</th>
239 </tr>
240
cristyd2432012015-05-04 23:15:15 +0000241 <tr>
242 <td>multiply</td>
243 <td>The source is multiplied by the destination and replaces
cristybc9539a2010-08-16 18:06:20 +0000244 the destination. The resultant color is always at least as dark as
245 either of the two constituent colors. Multiplying any color with black
246 produces black. Multiplying any color with white leaves the original
247 color unchanged.</td>
248 </tr>
249
cristyd2432012015-05-04 23:15:15 +0000250 <tr>
251 <td>screen</td>
252 <td>The source and destination are complemented and then
cristybc9539a2010-08-16 18:06:20 +0000253 multiplied and then replace the destination. The resultant color is
254 always at least as light as either of the two constituent colors.
255 Screening any color with white produces white. Screening any color
256 with black leaves the original color unchanged.</td>
257 </tr>
258
cristyd2432012015-05-04 23:15:15 +0000259 <tr>
260 <td>plus</td>
261 <td>The source is added to the destination and replaces the
Cristy542697a2015-10-12 20:10:32 -0400262 destination. This operator is useful for averaging or a controlled
cristybc9539a2010-08-16 18:06:20 +0000263 merger of two images, rather than a direct overlay.</td>
264 </tr>
265
cristyd2432012015-05-04 23:15:15 +0000266 <tr>
267 <td>add</td>
268 <td>As per 'plus' but transparency data is treated as matte
cristybc9539a2010-08-16 18:06:20 +0000269 values. As such any transparent areas in either image remain
270 transparent. </td>
271 </tr>
272
cristyd2432012015-05-04 23:15:15 +0000273 <tr>
274 <td>minus</td>
275 <td>Subtract the colors in the source image from the
cristybc9539a2010-08-16 18:06:20 +0000276 destination image. When transparency is involved, opaque areas is
277 subtracted from any destination opaque areas. </td>
278 </tr>
279
cristyd2432012015-05-04 23:15:15 +0000280 <tr>
281 <td>subtract</td>
282 <td>Subtract the colors in the source image from the
cristybc9539a2010-08-16 18:06:20 +0000283 destination image. When transparency is involved transparent areas are
284 subtracted, so only the opaque areas in the source remain opaque in
285 the destination image. </td>
286 </tr>
287
cristyd2432012015-05-04 23:15:15 +0000288 <tr>
289 <td>difference</td>
290 <td>Subtracts the darker of the two constituent colors from
cristybc9539a2010-08-16 18:06:20 +0000291 the lighter. Painting with white inverts the destination color.
292 Painting with black produces no change.</td>
293 </tr>
294
cristyd2432012015-05-04 23:15:15 +0000295 <tr>
296 <td>exclusion</td>
297 <td>Produces an effect similar to that of 'difference', but
cristybc9539a2010-08-16 18:06:20 +0000298 appears as lower contrast. Painting with white inverts the
299 destination color. Painting with black produces no change.</td>
300 </tr>
301
cristyd2432012015-05-04 23:15:15 +0000302 <tr>
303 <td>darken</td>
304 <td>Selects the darker of the destination and source colors.
cristybc9539a2010-08-16 18:06:20 +0000305 The destination is replaced with the source when the source is darker,
306 otherwise it is left unchanged.</td>
307 </tr>
308
cristyd2432012015-05-04 23:15:15 +0000309 <tr>
310 <td>lighten</td>
311 <td>Selects the lighter of the destination and source colors.
cristybc9539a2010-08-16 18:06:20 +0000312 The destination is replaced with the source when the source is
313 lighter, otherwise it is left unchanged. </td>
314 </tr>
315
Cristy8d6f6382020-03-19 18:36:11 -0400316 <tr>
317 <td>negate</td>
318 <td>The "opposite" of difference mode. Note that it is not difference mode inverted, because black and white return the same result, but colors between become brighter instead of darker. </td>
319 </tr>
320
321 <tr>
322 <td>reflect</td>
323 <td>This mode is useful when adding shining objects or light zones to images. The formula is similar to color dodge, but the result is not that bright in most cases. The result looks a bit like soft light. </td>
324 </tr>
325
326 <tr>
327 <td>freeze</td>
328 <td>Another variation of reflect mode (base and blend color inverted, the result inverted again). </td>
329 </tr>
330
331 <tr>
332 <td>stamp</td>
333 <td>This mode somehow is similar to average mode. It is helpful when applying relief or bump textures to images. </td>
334 </tr>
335
336 <tr>
337 <td>interpolate</td>
338 <td>This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors). </td>
339 </tr>
cristybc9539a2010-08-16 18:06:20 +0000340</table>
341
342<p>Typically these use the default 'Over' alpha blending when transparencies
cristyabd337d2010-08-17 01:06:59 +0000343are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
344means the alpha channel of both images will only be used to ensure that any
345visible input remains visible even in parts not overlaid. It also means that
346any values are weighted by the alpha channel of the input and output images.
347This 'Over' alpha blending is also applied to the lighting composition methods
348below. </p>
cristybc9539a2010-08-16 18:06:20 +0000349
Cristyc253f2f2020-06-12 19:17:20 -0400350<p> The math composition is applied on an individual channel basis as defined by the <a href="command-line-options.html#channel" >-channel</a>. This includes the alpha channel. This special usage allows you to perform true mathematics of the image channels, without alpha
Cristy542697a2015-10-12 20:10:32 -0400351composition effects, becoming involved. </p>
cristybc9539a2010-08-16 18:06:20 +0000352
cristybc9539a2010-08-16 18:06:20 +0000353<p>The following lighting composition methods are also available. </p>
354
Cristy6ed6e582020-09-18 21:47:29 +0000355<table class="table table-sm table-hover">
cristybc9539a2010-08-16 18:06:20 +0000356 <tbody>
cristyd2432012015-05-04 23:15:15 +0000357 <tr>
cristybc9539a2010-08-16 18:06:20 +0000358 <th align="left" style="width: 8%">Method</th>
359 <th align="left">Description</th>
360 </tr>
361
cristyd2432012015-05-04 23:15:15 +0000362 <tr>
363 <td>linear-dodge</td>
364 <td>This is equivalent to 'Plus' in that the color channels
cristybc9539a2010-08-16 18:06:20 +0000365 are simply added, however it does not 'Plus' the alpha channel, but
366 uses the normal 'Over' alpha blending, which transparencies are
Cristy13afdf02017-12-08 12:19:49 -0500367 involved. Produces a sort of additive multiply-like result. </td>
cristybc9539a2010-08-16 18:06:20 +0000368 </tr>
369
cristyd2432012015-05-04 23:15:15 +0000370 <tr>
371 <td>linear-burn</td>
372 <td>As 'Linear-Dodge', but also subtract one from the result.
Cristy13afdf02017-12-08 12:19:49 -0500373 Sort of a additive 'Screen' of the images. </td>
cristybc9539a2010-08-16 18:06:20 +0000374 </tr>
375
cristyd2432012015-05-04 23:15:15 +0000376 <tr>
377 <td>color-dodge</td>
378 <td>Brightens the destination color to reflect the source
cristybc9539a2010-08-16 18:06:20 +0000379 color. Painting with black produces no change.</td>
380 </tr>
381
cristyd2432012015-05-04 23:15:15 +0000382 <tr>
383 <td>color-burn</td>
384 <td>Darkens the destination color to reflect the source
Cristy13afdf02017-12-08 12:19:49 -0500385 color. Painting with white produces no change. </td>
cristybc9539a2010-08-16 18:06:20 +0000386 </tr>
387
cristyd2432012015-05-04 23:15:15 +0000388 <tr>
389 <td>overlay</td>
390 <td>Multiplies or screens the colors, dependent on the
cristybc9539a2010-08-16 18:06:20 +0000391 destination color. Source colors overlay the destination whilst
392 preserving its highlights and shadows. The destination color is not
393 replaced, but is mixed with the source color to reflect the lightness
394 or darkness of the destination.</td>
395 </tr>
396
cristyd2432012015-05-04 23:15:15 +0000397 <tr>
398 <td>hard-light</td>
399 <td>Multiplies or screens the colors, dependent on the source
cristybc9539a2010-08-16 18:06:20 +0000400 color value. If the source color is lighter than 0.5, the destination
401 is lightened as if it were screened. If the source color is darker
402 than 0.5, the destination is darkened, as if it were multiplied. The
403 degree of lightening or darkening is proportional to the difference
404 between the source color and 0.5. If it is equal to 0.5 the
405 destination is unchanged. Painting with pure black or white produces
406 black or white.</td>
407 </tr>
408
409
cristyd2432012015-05-04 23:15:15 +0000410 <tr>
411 <td>linear-light</td>
412 <td>Like 'Hard-Light' but using linear-dodge and linear-burn
cristybc9539a2010-08-16 18:06:20 +0000413 instead. Increases contrast slightly with an impact on the
414 foreground's tonal values.</td>
415 </tr>
416
cristyd2432012015-05-04 23:15:15 +0000417 <tr>
Cristy8d6f6382020-03-19 18:36:11 -0400418 <td>soft-burn</td>
419 <td>A combination of color burn and inverse color dodge mode, but a lot smoother than both of them. The base image is lightened a bit, but very dark blend colors are "burned" in. </td>
420 </tr>
421
422 <tr>
423 <td>soft-dodge</td>
424 <td> Combination of color dodge and inverse color burn mode, but a lot smoother than both of them. The base image is darkened a bit, but very bright blend colors are "dodged" in. </td>
425 </tr>
426
427 <tr>
cristyd2432012015-05-04 23:15:15 +0000428 <td>soft-light</td>
429 <td>Darkens or lightens the colors, dependent on the source
cristybc9539a2010-08-16 18:06:20 +0000430 color value. If the source color is lighter than 0.5, the destination
431 is lightened. If the source color is darker than 0.5, the destination
432 is darkened, as if it were burned in. The degree of darkening or
433 lightening is proportional to the difference between the source color
434 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
435 with pure black or white produces a distinctly darker or lighter area,
Cristy13afdf02017-12-08 12:19:49 -0500436 but does not result in pure black or white. </td>
cristybc9539a2010-08-16 18:06:20 +0000437 </tr>
438
cristyd2432012015-05-04 23:15:15 +0000439 <tr>
440 <td>pegtop-light</td>
441 <td>Almost equivalent to 'Soft-Light', but using a
Cristy542697a2015-10-12 20:10:32 -0400442 continuous mathematical formula rather than two conditionally
Cristy13afdf02017-12-08 12:19:49 -0500443 selected formulae. </td>
cristybc9539a2010-08-16 18:06:20 +0000444 </tr>
445
cristyd2432012015-05-04 23:15:15 +0000446 <tr>
447 <td>vivid-light</td>
448 <td>A modified 'Linear-Light' designed to preserve very stong
Cristy13afdf02017-12-08 12:19:49 -0500449 primary and secondary colors in the image. </td>
cristybc9539a2010-08-16 18:06:20 +0000450 </tr>
451
cristyd2432012015-05-04 23:15:15 +0000452 <tr>
453 <td>pin-light</td>
454 <td>Similar to 'Hard-Light', but using sharp linear shadings,
Cristy13afdf02017-12-08 12:19:49 -0500455 to simulate the effects of a strong 'pinhole' light source. </td>
cristybc9539a2010-08-16 18:06:20 +0000456 </tr>
457
458 </tbody>
459</table>
460
cristybc9539a2010-08-16 18:06:20 +0000461<p>Also included are these special purpose compose methods:</p>
462
Cristy6ed6e582020-09-18 21:47:29 +0000463<table class="table table-sm table-hover">
cristybc9539a2010-08-16 18:06:20 +0000464 <tbody>
cristyd2432012015-05-04 23:15:15 +0000465 <tr>
cristybc9539a2010-08-16 18:06:20 +0000466 <th align="left" style="width: 8%">Method</th>
467 <th align="left">Description</th>
468 </tr>
469
cristyd2432012015-05-04 23:15:15 +0000470 <tr>
471 <td>copy</td>
472 <td>This is equivalent to the Duff-Porter composition method
cristy8ee7f242013-06-20 16:08:44 +0000473 '<code>Src,</code>' but without clearing the parts of the destination
cristyabd337d2010-08-17 01:06:59 +0000474 image that is not overlaid. </td>
475 </tr>
476
cristyd2432012015-05-04 23:15:15 +0000477 <tr>
478 <td>copy-*</td>
479 <td>Copy the specified channel (Red, Green, Blue, Cyan,
cristybc9539a2010-08-16 18:06:20 +0000480 Magenta, Yellow, Black, or Opacity) in the source image to the
481 same channel in the destination image. If the channel specified
482 does not exist in the source image, (which can only happen for methods,
cristy8ee7f242013-06-20 16:08:44 +0000483 '<code>copy-opacity</code>' or '<code>copy-black</code>') then it is
cristybc9539a2010-08-16 18:06:20 +0000484 assumed that the source image is a special grayscale channel image
cristy075ad252010-10-30 21:56:17 +0000485 of the values that is to be copied. </td>
cristybc9539a2010-08-16 18:06:20 +0000486 </tr>
487
cristyd2432012015-05-04 23:15:15 +0000488 <tr>
489 <td>change-mask</td>
490 <td>Replace any destination pixel that is the similar to the
Cristy594d2772015-11-15 10:47:42 -0500491 source images pixel (as defined by the current <a
Cristyc253f2f2020-06-12 19:17:20 -0400492 href="command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
cristyabd337d2010-08-17 01:06:59 +0000493 </td>
cristybc9539a2010-08-16 18:06:20 +0000494 </tr>
Cristy13afdf02017-12-08 12:19:49 -0500495
496 <tr>
497 <td>stereo</td>
498 <td>create a stereo anaglyph</td>
499 </tr>
cristybc9539a2010-08-16 18:06:20 +0000500 </tbody>
501</table>
502
503<p>On top of these composed methods are a few special ones that not only require
504the two images that are being merged or overlaid, but have some extra numerical
505arguments, which are tabled below. </p>
506
507<p>In the "<code>composite</code>" command these composition methods are
508selected using special options with the arguments needed. They are usually,
Cristy542697a2015-10-12 20:10:32 -0400509but not always, the same name as the composite 'method' they use, and replaces
Cristyc253f2f2020-06-12 19:17:20 -0400510the normal use of the <a href="command-line-options.html#compose" >-compose</a>
cristyabd337d2010-08-17 01:06:59 +0000511setting in the "<code>composite</code>" command. For example... </p>
cristybc9539a2010-08-16 18:06:20 +0000512
Cristy5bf67322017-10-08 11:28:40 -0400513<pre class="highlight"><code>composite ... -blend 50x50 ...
Cristy49380402017-06-29 11:24:55 -0400514</code></pre>
cristyd2432012015-05-04 23:15:15 +0000515
Cristyc253f2f2020-06-12 19:17:20 -0400516<p>The "<code>magick</code>" command can accept these extra arguments to its <a href="command-line-options.html#composite"
517>-composite</a> operator, using the special <a href="command-line-options.html#define">-define</a>
cristy8ee7f242013-06-20 16:08:44 +0000518attribute of '<code class="arg">compose:args</code>'. This means you can now
Cristyc253f2f2020-06-12 19:17:20 -0400519make use of these special augmented <a href="command-line-options.html#compose"
Cristy594d2772015-11-15 10:47:42 -0500520>-compose</a> methods, those the argument and the method both need to be set
cristy29c5c992011-06-25 13:58:49 +0000521separately. For example... </p>
cristybc9539a2010-08-16 18:06:20 +0000522
Cristy917fa782020-02-21 08:50:35 -0500523<pre class="highlight"><code>magick ... -compose blend -define compose:args=50,50 -composite ...
Cristy49380402017-06-29 11:24:55 -0400524</code></pre>
cristyd2432012015-05-04 23:15:15 +0000525
cristybc9539a2010-08-16 18:06:20 +0000526<p>The following is a table of these special 'argumented' compose methods,
527with a brief summary of what they do. For more details see the equivalent
528"composite" command option name. </p>
529
Cristy6ed6e582020-09-18 21:47:29 +0000530<table class="table table-sm table-hover">
cristybc9539a2010-08-16 18:06:20 +0000531 <tbody>
cristyd2432012015-05-04 23:15:15 +0000532 <tr>
cristybc9539a2010-08-16 18:06:20 +0000533 <th align="left" style="width: 8%">Method</th>
534 <th align="left">Description</th>
535 </tr>
536
cristyd2432012015-05-04 23:15:15 +0000537 <tr>
538 <td>dissolve</td>
539 <td>Arguments:
540 <var>src_percent</var>[x<var>dst_percent</var>]
Cristyc253f2f2020-06-12 19:17:20 -0400541 <br/>Equivalent to "<code>composite</code>" <a href="command-line-options.html#dissolve">-dissolve</a>
Cristy594d2772015-11-15 10:47:42 -0500542 <br/>Dissolve the 'source' image by the percentage given before overlaying
cristyd2432012015-05-04 23:15:15 +0000543 'over' the 'destination' image. If <var>src_percent</var> is
cristybc9539a2010-08-16 18:06:20 +0000544 greater than 100, it starts dissolving the main image so it will
cristy8ee7f242013-06-20 16:08:44 +0000545 become transparent at a value of '<code class="arg">200</code>'. If
cristybc9539a2010-08-16 18:06:20 +0000546 both percentages are given, each image are dissolved to the
547 percentages given.
548 </td>
549 </tr>
550
cristyd2432012015-05-04 23:15:15 +0000551 <tr>
552 <td>blend</td>
553 <td>Arguments:
554 <var>src_percent</var>[x<var>dst_percent</var>]
Cristy594d2772015-11-15 10:47:42 -0500555 <br/>Equivalent to "<code>composite</code>" <a
Cristyc253f2f2020-06-12 19:17:20 -0400556 href="command-line-options.html#blend">-blend</a>
Cristy594d2772015-11-15 10:47:42 -0500557 <br/>Average the images together ('plus') according to the percentages
cristybc9539a2010-08-16 18:06:20 +0000558 given and each pixels transparency. If only a single percentage value
559 is given it sets the weight of the composite or 'source' image, while
560 the background image is weighted by the exact opposite amount. That is
cristy8ee7f242013-06-20 16:08:44 +0000561 a <code>-blend 30</code> merges 30% of the 'source' image with 70% of
562 the 'destination' image. Thus it is equivalent to <code>-blend
563 30x70</code>.
cristybc9539a2010-08-16 18:06:20 +0000564 </td>
565 </tr>
566
cristyd2432012015-05-04 23:15:15 +0000567 <tr>
568 <td>mathematics</td>
569 <td>Arguments: <var>A, B, C, D</var>
Cristy594d2772015-11-15 10:47:42 -0500570 <br/>Not available in "<code>composite</code>" at this time.
571 <br/>Merge the source and destination images according to the formula
572 <br/> <code>A*Sc*Dc + B*Sc + C*Dc + D</code>
573 <br/>Can be used to generate a custom composition method that would
574 otherwise need to be implemented using the slow <a
Cristyc253f2f2020-06-12 19:17:20 -0400575 href="command-line-options.html#fx">-fx</a> DIY image operator.
cristybc9539a2010-08-16 18:06:20 +0000576 </td>
577 </tr>
578
cristyd2432012015-05-04 23:15:15 +0000579 <tr>
580 <td>modulate</td>
581 <td>Arguments:
582 <var>brightness</var>[x<var>saturation</var>]
Cristyc253f2f2020-06-12 19:17:20 -0400583 <br/>Equivalent to "<code>composite</code>" <a href="command-line-options.html#watermark">-watermark</a>
Cristy594d2772015-11-15 10:47:42 -0500584 <br/>Take a grayscale image (with alpha mask) and modify the destination
cristybc9539a2010-08-16 18:06:20 +0000585 image's brightness according to watermark image's grayscale value and
cristyd2432012015-05-04 23:15:15 +0000586 the <var>brightness</var> percentage. The destinations
587 color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
cristybc9539a2010-08-16 18:06:20 +0000588 (no color change).
589
590 </td>
591 </tr>
592
cristyd2432012015-05-04 23:15:15 +0000593 <tr>
594 <td>displace</td>
595 <td>Arguments:
596 <var>X-scale</var>[x<var>Y-scale</var>][!][%]
Cristyc253f2f2020-06-12 19:17:20 -0400597 <br/>Equivalent to "<code>composite</code>" <a href="command-line-options.html#displace">-displace</a>
Cristy594d2772015-11-15 10:47:42 -0500598 <br/>With this option, the 'overlay' image, and optionally the 'mask'
cristybc9539a2010-08-16 18:06:20 +0000599 image, is used as a relative displacement map, which is used to
600 displace the lookup of what part of the destination image is seen at
601 each point of the overlaid area. Much like the displacement map is a
602 'lens' that distorts the original 'background' image behind it.
Cristy594d2772015-11-15 10:47:42 -0500603 <br/><br/>
cristy29c5c992011-06-25 13:58:49 +0000604 The X-scale is modulated by the 'red' channel of the overlay image
cristybc9539a2010-08-16 18:06:20 +0000605 while the Y-scale is modulated by the green channel, (the mask image
606 if given is rolled into green channel of the overlay image. This
607 separation allows you to modulate the X and Y lookup displacement
cristy29c5c992011-06-25 13:58:49 +0000608 separately allowing you to do 2-dimensional displacements, rather
Cristy542697a2015-10-12 20:10:32 -0400609 than 1-dimensional vectored displacements (using grayscale image).
Cristy594d2772015-11-15 10:47:42 -0500610 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000611 If the overlay image contains transparency this is used as a mask
612 of the resulting image to remove 'invalid' pixels.
Cristy594d2772015-11-15 10:47:42 -0500613 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000614 The '%' flag makes the displacement scale relative to the size of the
615 overlay image (100% = half width/height of image). Using '!' switches
616 percentage arguments to refer to the destination image size instead.
Cristy594d2772015-11-15 10:47:42 -0500617 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000618 </td>
619 </tr>
620
cristyd2432012015-05-04 23:15:15 +0000621 <tr>
622 <td>distort</td>
623 <td>Arguments:
624 <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
Cristy594d2772015-11-15 10:47:42 -0500625 <br/>Not available in "<code>composite</code>" at this time.
626 <br/>Exactly as per 'Displace' (above), but using absolute coordinates,
cristybc9539a2010-08-16 18:06:20 +0000627 relative to the center of the overlay (or that given). Basically
628 allows you to generate absolute distortion maps where 'black' will
629 look up the left/top edge, and 'white' looks up the bottom/right
630 edge of the destination image, according to the scale given.
Cristy594d2772015-11-15 10:47:42 -0500631 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000632 The '!' flag not only switches percentage scaling, to use the
633 destination image, but also the image the center offset of the lookup.
634 This means the overlay can lookup a completely different region of the
635 destination image.
Cristy594d2772015-11-15 10:47:42 -0500636 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000637 </td>
638 </tr>
639
cristyd2432012015-05-04 23:15:15 +0000640 <tr>
641 <td>blur</td>
642 <td>Arguments:
643 <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
Cristyc253f2f2020-06-12 19:17:20 -0400644 <br/>Equivalent to "<code>composite</code>" <a href="command-line-options.html#blur-composite">-blur</a>
Cristy594d2772015-11-15 10:47:42 -0500645 <br/>A Variable Blur Mapping Composition method, where each pixel in the
cristybc9539a2010-08-16 18:06:20 +0000646 overlaid region is replaced with an Elliptical Weighted Average (EWA),
647 with an ellipse (typically a circle) of the given sigma size, scaled
648 according to overlay (source image) grayscale mapping.
Cristy594d2772015-11-15 10:47:42 -0500649 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000650 As per 'Displace' and 'Distort', the red channel will modulate the
651 width of the ellipse, while the green channel will modulate the height
cristy075ad252010-10-30 21:56:17 +0000652 of the ellipse. If a single Angle value is given in the arguments,
Cristy542697a2015-10-12 20:10:32 -0400653 then the ellipse will then be rotated by the angle specified.
Cristy594d2772015-11-15 10:47:42 -0500654 <br/><br/>
cristy075ad252010-10-30 21:56:17 +0000655 Normally the blue channel of the mapping overlay image is ignored.
656 However if a second ellipse angle is given, then it is assumed that
657 the blue channel defines a variable angle for the ellipse ranging from
658 the first angle to the second angle given. This allows to generate
659 radial blurs, or a rough approximation for rotational blur. Or any mix
660 of the two.
Cristy594d2772015-11-15 10:47:42 -0500661 <br/><br/>
cristybc9539a2010-08-16 18:06:20 +0000662 </td>
663 </tr>
664
665 </tbody>
666</table>
667
Cristy594d2772015-11-15 10:47:42 -0500668<p>To print a complete list of all the available compose operators, use <a
Cristyc253f2f2020-06-12 19:17:20 -0400669href="command-line-options.html#list">-list compose</a>.</p>
cristy751980d2012-06-03 23:18:35 +0000670</div>
Cristy13afdf02017-12-08 12:19:49 -0500671 </div>
672 </main><!-- /.container -->
cristyd2432012015-05-04 23:15:15 +0000673 <footer class="magick-footer">
Cristy0e12ff62020-07-30 17:19:08 -0400674 <div class="container">
Cristyc253f2f2020-06-12 19:17:20 -0400675 <p><a href="security-policy.html">Security</a>
Cristy78ad9052020-09-26 13:55:20 +0000676 <a href="news.html">News</a>
Cristy15efeaa2019-11-28 09:22:08 -0500677
678 <a href="compose.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
679
Cristyc253f2f2020-06-12 19:17:20 -0400680 <a href="links.html">Related</a>
681 <a href="sitemap.html">Sitemap</a>
Cristy15efeaa2019-11-28 09:22:08 -0500682 <br/>
Cristyc253f2f2020-06-12 19:17:20 -0400683 <a href="support.html">Sponsor</a>
684 <a href="cite.html">Cite</a>
Cristy15efeaa2019-11-28 09:22:08 -0500685 <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
Cristyc253f2f2020-06-12 19:17:20 -0400686 <a href="https://imagemagick.org/script/contact.php">Contact Us</a>
Cristy9848db82017-12-17 09:43:57 -0500687 <br/>
Cristy917fa782020-02-21 08:50:35 -0500688 <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a>
689 <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 416.32" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path fill="currentColor" d="M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92"/></svg></a>
690 <br/>
Cristyd8420112021-01-01 14:52:00 -0500691 <small>© 1999-2021 ImageMagick Studio LLC</small></p>
Cristy0e12ff62020-07-30 17:19:08 -0400692 <div>
cristyd2432012015-05-04 23:15:15 +0000693 </footer>
cristyad41c0c2012-10-31 00:49:28 +0000694
Cristy13afdf02017-12-08 12:19:49 -0500695 <!-- Javascript assets -->
Cristy78ad9052020-09-26 13:55:20 +0000696 <script>window.jQuery || document.write('<script src="assets/jquery.slim.min.js"><\/script>')</script><script src="assets/bootstrap.bundle.min.js" integrity="sha384-LtrjvnR4Twt/qOuYxE721u19sVFLVSA4hf/rRt6PrZTmiPltdZcI7q7PXQBYTKyf" crossorigin="anonymous">
cristyad41c0c2012-10-31 00:49:28 +0000697</body>
cristy5a367e42015-05-05 12:39:18 +0000698</html>
Cristyd8420112021-01-01 14:52:00 -0500699<!-- Magick Cache 1st January 2021 18:30 -->