Debian Codegraph @

www/compose.html

raw symbols ◀ ▶ SCIP
4 Debian patches touch this file
1
2
3
•4 <!DOCTYPE html>
5 <html lang="en" data-bs-theme="dark">
6 <head>
7 <script src="assets/color-modes.js" ></script>
8 <meta charset="utf-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1" />
10 <title>ImageMagick – Alpha Compositing</title>
11 <meta name="keywords" content="Alpha Compositing, Image Processing, Digital Image Editing, Image Conversion, Open-Source Software, Image Manipulation, Command-Line Image Tools" />
12 <meta name="description" content="ImageMagick is a powerful, open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for web developers, graphic designers, and researchers, it offers versatile tools for image processing, including batch processing, format conversion, and complex image transformations." />
13 <meta name="application-name" content="ImageMagick" />
14 <meta name="application-url" content="https://imagemagick.org" />
15 <meta name="copyright" content="Copyright (c) 1999 ImageMagick Studio LLC" />
16 <meta itemprop='url' content='../' />
17 <meta itemprop='title' content='ImageMagick' />
18 <meta itemprop='description' content="ImageMagick is a powerful, open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for web developers, graphic designers, and researchers, it offers versatile tools for image processing, including batch processing, format conversion, and complex image transformations." />
19 <meta property='og:url' content='../' />
20 <meta property='og:name' content='ImageMagick' />
21 <meta property='og:image' content='../images/logo.png' />
22 <meta property='og:type' content='website' />
23 <meta property='og:site_name' content='ImageMagick' />
24 <meta property='og:description' content="ImageMagick is a powerful, open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for web developers, graphic designers, and researchers, it offers versatile tools for image processing, including batch processing, format conversion, and complex image transformations." />
25 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
26 <link type="images/png" sizes="64x64" href="../images/wand.png" rel="icon" />
27 <link type="images/icon" sizes="16x16" href="../images/wand.ico" rel="shortcut icon" />
28 <link href="compose.html" rel="canonical" />
29 <link href="assets/bootstrap.min.css" rel="stylesheet" />
30 </head>
31 <body>
32 <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
33 <symbol id="check2" viewBox="0 0 16 16">
34 <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
35 </symbol>
36 <symbol id="circle-half" viewBox="0 0 16 16">
37 <path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
38 </symbol>
39 <symbol id="moon-stars-fill" viewBox="0 0 16 16">
40 <path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"/>
41 <path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z"/>
42 </symbol>
43 <symbol id="sun-fill" viewBox="0 0 16 16">
44 <path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/>
45 </symbol>
46 </svg>
47 <div class="dropdown position-fixed bottom-0 end-0 mb-3 me-3 bd-mode-toggle">
48 <button class="btn btn-bd-secondary py-2 dropdown-toggle d-flex align-items-center"
49 id="bd-theme"
50 type="button"
51 aria-expanded="false"
52 data-bs-toggle="dropdown"
53 aria-label="Toggle theme (auto)">
54 <svg class="bi my-1 theme-icon-active" width="1em" height="1em"><use href="#circle-half"></use></svg>
55 <span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
56 </button>
57 <ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="bd-theme-text">
58 <li>
59 <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
60 <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#sun-fill"></use></svg>
61 Light
62 <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
63 </button>
64 </li>
65 <li>
66 <button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="dark" aria-pressed="false">
67 <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#moon-stars-fill"></use></svg>
68 Dark
69 <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
70 </button>
71 </li>
72 <li>
73 <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="auto" aria-pressed="true">
74 <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#circle-half"></use></svg>
75 Auto
76 <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="#check2"></use></svg>
77 </button>
78 </li>
79 </ul>
80 </div>
81 <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
82 <symbol id="arrow-right-circle" viewBox="0 0 16 16">
83 <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z"/>
84 </symbol>
85 <symbol id="color-mode" viewBox="0 0 118 94">
86 <title>Color Modes</title>
87 <path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z"></path>
88 </symbol>
89 </svg>
90 <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
91 <div class="container-fluid">
92 <a class="navbar-brand" href="../index.html"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
93 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#magick-navbars" aria-controls="magick-navbars" aria-expanded="false" aria-label="Toggle navigation">
94 <span class="navbar-toggler-icon"></span>
95 </button>
96
97 <div class="collapse navbar-collapse" id="magick-navbars">
98 <ul class="navbar-nav me-auto mb-2 mb-md-0">
99 <li class="nav-item">
100 <a class="nav-link " href="download.html">Download</a>
101 </li>
102 <li class="nav-item">
103 <a class="nav-link " href="command-line-tools.html">Tools</a>
104 </li>
105 <li class="nav-item">
106 <a class="nav-link " href="command-line-processing.html">CLI</a>
107 </li>
108 <li class="nav-item">
109 <a class="nav-link " href="develop.html">Develop</a>
110 </li>
111 <li class="nav-item">
112 <a class="nav-link" rel="noopener" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
113 </li>
114 <li class="nav-item">
•115
116 </li>
117 </ul>
118 </div>
119 </div>
120 </nav>
121
122 <div class="col-lg-8 mx-auto p-4 py-md-5 text-body-secondary">
123 <header class="d-flex align-items-center pb-3 mb-5 border-bottom">
124 <a href="../index.html" class="d-flex align-items-center text-decoration-none">
125 <h1 class="mt-5 fs-4">Alpha Compositing</h1>
126 </a>
127 </header>
128
129 <main class="container">
130 <div>
131 <div id="cli-examples"></div>
132
133 <p class="lead">This page described the Image composition methods that is used to define how
134 two images should be merged together in various image operations. For the
135 Command Line API it is typically set using the <a
136 href="command-line-options.html#compose" >-compose</a> setting option. </p>
137
138
139 <p>The description of composition uses abstract terminology in order to allow
140 the description to be more precise, while avoiding constant values which are
141 specific to a particular build configuration. Each image pixel is represented
142 by red, green, and blue levels (which are equal for a gray pixel). The
143 build-dependent value <var>QuantumRange</var> is the maximum integral
144 value which may be stored, per pixel, in the red, green, or blue channels of
145 the image. Each image pixel may also optionally (if the image matte channel is
146 enabled) have an associated level of opacity, ranging from <var>opaque</var> to
147 <var>transparent</var>, which may be used to determine the influence of the pixel
148 color when compositing the pixel with another image pixel. If the image matte
149 channel is disabled, then all pixels in the image are treated as opaque. The
150 color of an opaque pixel is fully visible while the color of a transparent
151 pixel color is entirely absent (pixel color is ignored).</p>
152
153 <p>By definition, raster images have a rectangular shape. All image rows are of
154 equal length, as are all image columns. By treating the alpha channel as a
155 visual "mask" the rectangular image may be given a "shape" by treating the
156 alpha channel as a cookie-cutter for the image. This is done by setting the
157 pixels within the shape to be opaque, with pixels outside the shape set as
158 transparent. Pixels on the boundary of the shape may be between opaque and
159 transparent in order to provide antialiasing (visually smooth edges). The
160 description of the composition operators use this concept of image "shape" in
161 order to make the description of the operators easier to understand. While it
162 is convenient to describe the operators in terms of "shapes" they are by no
163 means limited to mask-style operations since they are based on continuous
164 floating-point mathematics rather than simple boolean operations.</p>
165
166 <p>The following alpha blending (Duff-Porter) compose methods are available:</p>
167
168 <table class="table table-sm table-hover table-striped table-responsive">
169 <tbody>
170 <tr>
171 <th align="left" style="width: 8%">Method</th>
172 <th align="left">Description</th>
173 </tr>
174
175 <tr>
176 <td>clear</td>
177 <td>Both the color and the alpha of the destination are
178 cleared. Neither the source nor the destination are used (except for
179 destinations size and other meta-data which is always preserved.</td>
180 </tr>
181
182 <tr>
183 <td>src</td>
184 <td>The source is copied to the destination. The destination
185 is not used as input, though it is cleared.</td>
186 </tr>
187
188 <tr>
189 <td>dst</td>
190 <td>The destination is left untouched. The source image is
191 completely ignored.</td>
192 </tr>
193
194 <tr>
195 <td>src-over</td>
196 <td>The source is composited over the destination. this is
197 the default alpha blending compose method, when neither the compose
198 setting is set, nor is set in the image meta-data.</td>
199 </tr>
200
201 <tr>
202 <td>dst-over</td>
203 <td>The destination is composited over the source and the
204 result replaces the destination.</td>
205 </tr>
206
207 <tr>
208 <td>src-in</td>
209 <td>The part of the source lying inside of the destination
210 replaces the destination.</td>
211 </tr>
212
213 <tr>
214 <td>dst-in</td>
215 <td>The part of the destination lying inside of the source
216 replaces the destination. Areas not overlaid are cleared.</td>
217 </tr>
218
219 <tr>
220 <td>src-out</td>
221 <td>The part of the source lying outside of the destination
222 replaces the destination.</td>
223 </tr>
224
225 <tr>
226 <td>dst-out</td>
227 <td>The part of the destination lying outside of the source
228 replaces the destination.</td>
229 </tr>
230
231 <tr>
232 <td>src-atop</td>
233 <td>The part of the source lying inside of the destination is
234 composited onto the destination.</td>
235 </tr>
236
237 <tr>
238 <td>dst-atop</td>
239 <td>The part of the destination lying inside of the source is
240 composited over the source and replaces the destination. Areas not
241 overlaid are cleared. </td>
242 </tr>
243
244 <tr>
245 <td>xor</td>
246 <td>The part of the source that lies outside of the
247 destination is combined with the part of the destination that lies
248 outside of the source. Source or Destination, but not both. </td>
249 </tr>
250
251 </tbody>
252 </table>
253
254 <p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
255 For example the default compose method can be specified as just 'Over'.</p>
256
257 <p>Many of these compose methods will clear the destination image which was
258 not overlaid by the source image. This is to be expected as part of that
259 specific composition methods definition. You can disable this by setting the
260 special <a href="command-line-options.html#define"
261 >-define</a> 'compose:outside-overlay' to a value of 'false' will turn off
262 this behavior. </p>
263
264 <p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
265 related method '<samp>Copy</samp>' has been provided. This is equivalent to
266 using the '<samp>Src</samp>' with the special <a href="command-line-options.html#define"
267 >-define</a> option '<samp>compose:outside-overlay</samp>' set to
268 '<samp>false</samp>', so as to only modify the overlaid area, without clearing
269 the rest of the image outside the overlaid area. </p>
270
271 <p>The following mathematical composition methods are also available. </p>
272
273 <table class="table table-sm table-hover table-striped table-responsive">
274 <tbody>
275 <tr>
276 <th align="left" style="width: 8%">Method</th>
277 <th align="left">Description</th>
278 </tr>
279
280 <tr>
281 <td>multiply</td>
282 <td>The source is multiplied by the destination and replaces
283 the destination. The resultant color is always at least as dark as
284 either of the two constituent colors. Multiplying any color with black
285 produces black. Multiplying any color with white leaves the original
286 color unchanged.</td>
287 </tr>
288
289 <tr>
290 <td>screen</td>
291 <td>The source and destination are complemented and then
292 multiplied and then replace the destination. The resultant color is
293 always at least as light as either of the two constituent colors.
294 Screening any color with white produces white. Screening any color
295 with black leaves the original color unchanged.</td>
296 </tr>
297
298 <tr>
299 <td>plus</td>
300 <td>The source is added to the destination and replaces the
301 destination. This operator is useful for averaging or a controlled
302 merger of two images, rather than a direct overlay.</td>
303 </tr>
304
305 <tr>
306 <td>add</td>
307 <td>As per 'plus' but transparency data is treated as matte
308 values. As such any transparent areas in either image remain
309 transparent. </td>
310 </tr>
311
312 <tr>
313 <td>minus</td>
314 <td>Subtract the colors in the source image from the
315 destination image. When transparency is involved, opaque areas is
316 subtracted from any destination opaque areas. </td>
317 </tr>
318
319 <tr>
320 <td>subtract</td>
321 <td>Subtract the colors in the source image from the
322 destination image. When transparency is involved transparent areas are
323 subtracted, so only the opaque areas in the source remain opaque in
324 the destination image. </td>
325 </tr>
326
327 <tr>
328 <td>difference</td>
329 <td>Subtracts the darker of the two constituent colors from
330 the lighter. Painting with white inverts the destination color.
331 Painting with black produces no change.</td>
332 </tr>
333
334 <tr>
335 <td>exclusion</td>
336 <td>Produces an effect similar to that of 'difference', but
337 appears as lower contrast. Painting with white inverts the
338 destination color. Painting with black produces no change.</td>
339 </tr>
340
341 <tr>
342 <td>darken</td>
343 <td>Selects the darker of the destination and source colors.
344 The destination is replaced with the source when the source is darker,
345 otherwise it is left unchanged.</td>
346 </tr>
347
348 <tr>
349 <td>lighten</td>
350 <td>Selects the lighter of the destination and source colors.
351 The destination is replaced with the source when the source is
352 lighter, otherwise it is left unchanged. </td>
353 </tr>
354
355 <tr>
356 <td>negate</td>
357 <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>
358 </tr>
359
360 <tr>
361 <td>reflect</td>
362 <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>
363 </tr>
364
365 <tr>
366 <td>freeze</td>
367 <td>Another variation of reflect mode (base and blend color inverted, the result inverted again). </td>
368 </tr>
369
370 <tr>
371 <td>stamp</td>
372 <td>This mode somehow is similar to average mode. It is helpful when applying relief or bump textures to images. </td>
373 </tr>
374
375 <tr>
376 <td>interpolate</td>
377 <td>This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors). </td>
378 </tr>
•379 </tbody>
380 </table>
381
382 <p>Typically these use the default 'Over' alpha blending when transparencies
383 are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
384 means the alpha channel of both images will only be used to ensure that any
385 visible input remains visible even in parts not overlaid. It also means that
386 any values are weighted by the alpha channel of the input and output images.
387 This 'Over' alpha blending is also applied to the lighting composition methods
388 below. </p>
389
390 <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
391 composition effects, becoming involved. </p>
392
393 <p>Use <samp>-define compose:sync=false</samp> and the above mathematical compositions will no longer synchronise its actions with the alpha channel. Instead 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 composition effects, becoming involved.</p>
394
395 <p>This define is not applied to the lighting composition methods (see below) even though they are closely related to mathematical composition methods.</p>
396
397 <p>The following lighting composition methods are also available. </p>
398
399 <table class="table table-sm table-hover table-striped table-responsive">
400 <tbody>
401 <tr>
402 <th align="left" style="width: 8%">Method</th>
403 <th align="left">Description</th>
404 </tr>
405
406 <tr>
407 <td>linear-dodge</td>
408 <td>This is equivalent to 'Plus' in that the color channels
409 are simply added, however it does not 'Plus' the alpha channel, but
410 uses the normal 'Over' alpha blending, which transparencies are
411 involved. Produces a sort of additive multiply-like result. </td>
412 </tr>
413
414 <tr>
415 <td>linear-burn</td>
416 <td>As 'Linear-Dodge', but also subtract one from the result.
417 Sort of a additive 'Screen' of the images. </td>
418 </tr>
419
420 <tr>
421 <td>color-dodge</td>
422 <td>Brightens the destination color to reflect the source
423 color. Painting with black produces no change.</td>
424 </tr>
425
426 <tr>
427 <td>color-burn</td>
428 <td>Darkens the destination color to reflect the source
429 color. Painting with white produces no change. </td>
430 </tr>
431
432 <tr>
433 <td>overlay</td>
434 <td>Multiplies or screens the colors, dependent on the
435 destination color. Source colors overlay the destination whilst
436 preserving its highlights and shadows. The destination color is not
437 replaced, but is mixed with the source color to reflect the lightness
438 or darkness of the destination.</td>
439 </tr>
440
441 <tr>
442 <td>hard-light</td>
443 <td>Multiplies or screens the colors, dependent on the source
444 color value. If the source color is lighter than 0.5, the destination
445 is lightened as if it were screened. If the source color is darker
446 than 0.5, the destination is darkened, as if it were multiplied. The
447 degree of lightening or darkening is proportional to the difference
448 between the source color and 0.5. If it is equal to 0.5 the
449 destination is unchanged. Painting with pure black or white produces
450 black or white.</td>
451 </tr>
452
453
454 <tr>
455 <td>linear-light</td>
456 <td>Like 'Hard-Light' but using linear-dodge and linear-burn
457 instead. Increases contrast slightly with an impact on the
458 foreground's tonal values.</td>
459 </tr>
460
461 <tr>
462 <td>soft-burn</td>
463 <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>
464 </tr>
465
466 <tr>
467 <td>soft-dodge</td>
468 <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>
469 </tr>
470
471 <tr>
472 <td>soft-light</td>
473 <td>Darkens or lightens the colors, dependent on the source
474 color value. If the source color is lighter than 0.5, the destination
475 is lightened. If the source color is darker than 0.5, the destination
476 is darkened, as if it were burned in. The degree of darkening or
477 lightening is proportional to the difference between the source color
478 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
479 with pure black or white produces a distinctly darker or lighter area,
480 but does not result in pure black or white. </td>
481 </tr>
482
483 <tr>
484 <td>pegtop-light</td>
485 <td>Almost equivalent to 'Soft-Light', but using a
486 continuous mathematical formula rather than two conditionally
487 selected formulae. </td>
488 </tr>
489
490 <tr>
491 <td>vivid-light</td>
492 <td>A modified 'Linear-Light' designed to preserve very strong
493 primary and secondary colors in the image. </td>
494 </tr>
495
496 <tr>
497 <td>pin-light</td>
498 <td>Similar to 'Hard-Light', but using sharp linear shadings,
499 to simulate the effects of a strong 'pinhole' light source. </td>
500 </tr>
501
502 </tbody>
503 </table>
504
505 <p>Also included are these special purpose compose methods:</p>
506
507 <table class="table table-sm table-hover table-striped table-responsive">
508 <tbody>
509 <tr>
510 <th align="left" style="width: 8%">Method</th>
511 <th align="left">Description</th>
512 </tr>
513
514 <tr>
515 <td>copy</td>
516 <td>This is equivalent to the Duff-Porter composition method
517 '<samp>Src,</samp>' but without clearing the parts of the destination
518 image that is not overlaid. </td>
519 </tr>
520
521 <tr>
522 <td>copy-*</td>
523 <td>Copy the specified channel (Red, Green, Blue, Cyan,
524 Magenta, Yellow, Black, or Opacity) in the source image to the
525 same channel in the destination image. If the channel specified
526 does not exist in the source image, (which can only happen for methods,
527 '<samp>copy-opacity</samp>' or '<samp>copy-black</samp>') then it is
528 assumed that the source image is a special grayscale channel image
529 of the values that is to be copied. </td>
530 </tr>
531
532 <tr>
533 <td>change-mask</td>
534 <td>Replace any destination pixel that is the similar to the
535 source images pixel (as defined by the current <a
536 href="command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
537 </td>
538 </tr>
539
540 <tr>
541 <td>stereo</td>
542 <td>create a stereo anaglyph</td>
543 </tr>
544 </tbody>
545 </table>
546
547 <p>On top of these composed methods are a few special ones that not only require
548 the two images that are being merged or overlaid, but have some extra numerical
549 arguments, which are tabled below. </p>
550
551 <p>In the "<samp>composite</samp>" command these composition methods are
552 selected using special options with the arguments needed. They are usually,
553 but not always, the same name as the composite 'method' they use, and replaces
554 the normal use of the <a href="command-line-options.html#compose" >-compose</a>
555 setting in the "<samp>composite</samp>" command. For example... </p>
556
557 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>composite ... -blend 50x50 ... </samp></pre>
558
559 <p>The "<samp>magick</samp>" command can accept these extra arguments to its <a href="command-line-options.html#composite"
560 >-composite</a> operator, using the special <a href="command-line-options.html#define">-define</a>
561 attribute of <samp>compose:args</samp>. This means you can now
562 make use of these special augmented <a href="command-line-options.html#compose"
563 >-compose</a> methods, those the argument and the method both need to be set
564 separately. For example... </p>
565
566 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary cli"><samp>magick ... -compose blend -define compose:args=50,50 -composite ... </samp></pre>
567
568 <p>The following is a table of these special 'argumented' compose methods,
569 with a brief summary of what they do. For more details see the equivalent
570 "composite" command option name. </p>
571
572 <table class="table table-sm table-hover table-striped table-responsive">
573 <tbody>
574 <tr>
575 <th align="left" style="width: 8%">Method</th>
576 <th align="left">Description</th>
577 </tr>
578
579 <tr>
580 <td>dissolve</td>
581 <td>Arguments:
582 <var>src_percent</var>[x<var>dst_percent</var>]
583 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#dissolve">-dissolve</a>.
584 Dissolve the 'source' image by the percentage given before overlaying
585 'over' the 'destination' image. If <var>src_percent</var> is
586 greater than 100, it starts dissolving the main image so it will
587 become transparent at a value of <samp>200</samp>. If
588 both percentages are given, each image are dissolved to the
589 percentages given.
590 </td>
591 </tr>
592
593 <tr>
594 <td>blend</td>
595 <td>Arguments:
596 <var>src_percent</var>[x<var>dst_percent</var>]
597 <br/>Equivalent to "<samp>composite</samp>" <a
598 href="command-line-options.html#blend">-blend</a>.
599 Average the images together ('plus') according to the percentages
600 given and each pixels transparency. If only a single percentage value
601 is given it sets the weight of the composite or 'source' image, while
602 the background image is weighted by the exact opposite amount. That is
603 a <samp>-blend 30</samp> merges 30% of the 'source' image with 70% of
604 the 'destination' image. Thus it is equivalent to <samp>-blend
605 30x70</samp>.
606 </td>
607 </tr>
608
609 <tr>
610 <td>mathematics</td>
611 <td>Arguments: <var>A, B, C, D</var>
612 <br/>Not available in "<samp>composite</samp>" at this time.
613 Merge the source and destination images according to the formula
614 <ul><samp>A*Sc*Dc + B*Sc + C*Dc + D</samp></ul>
615 Can be used to generate a custom composition method that would
616 otherwise need to be implemented using the slow <a
617 href="command-line-options.html#fx">-fx</a> DIY image operator.
618 </td>
619 </tr>
620
621 <tr>
622 <td>modulate</td>
623 <td>Arguments:
624 <var>brightness</var>[x<var>saturation</var>]
625 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#watermark">-watermark</a>.
626 Take a grayscale image (with alpha mask) and modify the destination
627 image's brightness according to watermark image's grayscale value and
628 the <var>brightness</var> percentage. The destinations
629 color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
630 (no color change).
631
632 </td>
633 </tr>
634
635 <tr>
636 <td>displace</td>
637 <td>Arguments:
638 <var>X-scale</var>[x<var>Y-scale</var>][!][%]
639 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#displace">-displace</a>.
640 With this option, the 'overlay' image, and optionally the 'mask'
641 image, is used as a relative displacement map, which is used to
642 displace the lookup of what part of the destination image is seen at
643 each point of the overlaid area. Much like the displacement map is a
644 'lens' that distorts the original 'background' image behind it.
645 <br/><br/>
646 The X-scale is modulated by the 'red' channel of the overlay image
647 while the Y-scale is modulated by the green channel, (the mask image
648 if given is rolled into green channel of the overlay image. This
649 separation allows you to modulate the X and Y lookup displacement
650 separately allowing you to do 2-dimensional displacements, rather
651 than 1-dimensional vectored displacements (using grayscale image).
652 <br/><br/>
653 If the overlay image contains transparency this is used as a mask
654 of the resulting image to remove 'invalid' pixels.
655 <br/><br/>
656 The '%' flag makes the displacement scale relative to the size of the
657 overlay image (100% = half width/height of image). Using '!' switches
658 percentage arguments to refer to the destination image size instead.
659 <br/><br/>
660 </td>
661 </tr>
662
663 <tr>
664 <td>distort</td>
665 <td>Arguments:
666 <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
667 <br/>Not available in "<samp>composite</samp>" at this time.
668 Exactly as per 'Displace' (above), but using absolute coordinates,
669 relative to the center of the overlay (or that given). Basically
670 allows you to generate absolute distortion maps where 'black' will
671 look up the left/top edge, and 'white' looks up the bottom/right
672 edge of the destination image, according to the scale given.
673 <br/><br/>
674 The '!' flag not only switches percentage scaling, to use the
675 destination image, but also the image the center offset of the lookup.
676 This means the overlay can lookup a completely different region of the
677 destination image.
678 <br/><br/>
679 </td>
680 </tr>
681
682 <tr>
683 <td>blur</td>
684 <td>Arguments:
685 <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
686 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#blur-composite">-blur</a>.
687 A Variable Blur Mapping Composition method, where each pixel in the
688 overlaid region is replaced with an Elliptical Weighted Average (EWA),
689 with an ellipse (typically a circle) of the given sigma size, scaled
690 according to overlay (source image) grayscale mapping.
691 <br/><br/>
692 As per 'Displace' and 'Distort', the red channel will modulate the
693 width of the ellipse, while the green channel will modulate the height
694 of the ellipse. If a single Angle value is given in the arguments,
695 then the ellipse will then be rotated by the angle specified.
696 <br/><br/>
697 Normally the blue channel of the mapping overlay image is ignored.
698 However if a second ellipse angle is given, then it is assumed that
699 the blue channel defines a variable angle for the ellipse ranging from
700 the first angle to the second angle given. This allows to generate
701 radial blurs, or a rough approximation for rotational blur. Or any mix
702 of the two.
703 <br/><br/>
704 </td>
705 </tr>
706 <tr>
707 <td>seamless-blend</td>
708 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
709 <p>Seamlessly inserts the overlay image onto the background image. This operator requires a mask. Set the maximum iterations and distortion when seamlessly blending a foreground object onto a background image. The distortion is the RMSE between each iteration, a good start might be 300x0.0001. Note, seamless blending works most effectively when the HDRI feature is enabled.</p>
710 </td>
711 </tr>
712 <tr>
713 <td>saliency-blend</td>
714 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
715 <p>Merges the overlay image with the background image such that the image that is most salient (has the most detail) at a given pixel will show in the result. This operator requires a mask. Set the maximum iterations and distortion when seamlessly blending a foreground object onto a background image. The distortion is the RMSE between each iteration, a good start might be 300x0.0001. Note, seamless blending works most effectively when the HDRI feature is enabled. Saliency-blending will be a bit slower than seamless blending.</p>
716 </td>
717 </tr>
718
719
720 </tbody>
721 </table>
722
723 <p>To print a complete list of all the available compose operators, use <a
724 href="command-line-options.html#list">-list compose</a>.</p>
725 </div>
726 </main><!-- /.container -->
727 <footer class="text-center pt-5 my-5 text-body-secondary border-top">
728 <div class="container-fluid">
729 <a href="security-policy.html">Security</a> •
730 <a href="news.html">News</a>
731
732 <a href="#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
733
734 <a href="links.html">Related</a> •
735 <a href="sitemap.html">Sitemap</a>
736 <br/>
737 <a href="support.html">Sponsor</a> •
738 <a href="cite.html">Cite</a> •
739 <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
740 <a href="../www/../www/../www/../www/https://imagemagick.org/script/contact.php">Contact Us</a>
741 <br/>
742 <a href="https://github.com/imagemagick/imagemagick" rel="noopener" target="_blank" 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> •
743 <a href="https://twitter.com/imagemagick" rel="noopener" target="_blank" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 300 300" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path d="M178.57 127.15 290.27 0h-26.46l-97.03 110.38L89.34 0H0l117.13 166.93L0 300.25h26.46l102.4-116.59 81.8 116.59h89.34M36.01 19.54H76.66l187.13 262.13h-40.66"/></svg></a>
744 <br/>
745 <small>Copyright © 1999 ImageMagick Studio LLC</small>
746 </div>
747 </footer>
748 </div>
749
750 <!-- Javascript assets -->
751 <script src="assets/bootstrap.bundle.min.js" ></script>
752 </body>
753 </html>
754 <!-- Magick Cache 1st March 2025 18:53 -->