Debian Codegraph @

www/compose.html

raw ◀ ▶
Source reconstructed at patch state 0 of 4 — not the installed (fully patched) source.
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 <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
116 </li>
117 </ul>
118 <form class="d-flex form-inline" action="search.html">
119 <input class="form-control me-2" type="text" name="q" placeholder="Search" aria-label="Search">
120 <button class="btn btn-outline-success" type="submit" name="sa">Search</button>
121 </form>
122 </div>
123 </div>
124 </nav>
125
126 <div class="col-lg-8 mx-auto p-4 py-md-5 text-body-secondary">
127 <header class="d-flex align-items-center pb-3 mb-5 border-bottom">
128 <a href="../index.html" class="d-flex align-items-center text-decoration-none">
129 <h1 class="mt-5 fs-4">Alpha Compositing</h1>
130 </a>
131 </header>
132
133 <main class="container">
134 <div>
135 <div id="cli-examples"></div>
136
137 <p class="lead">This page described the Image composition methods that is used to define how
138 two images should be merged together in various image operations. For the
139 Command Line API it is typically set using the <a
140 href="command-line-options.html#compose" >-compose</a> setting option. </p>
141
142
143 <p>The description of composition uses abstract terminology in order to allow
144 the description to be more precise, while avoiding constant values which are
145 specific to a particular build configuration. Each image pixel is represented
146 by red, green, and blue levels (which are equal for a gray pixel). The
147 build-dependent value <var>QuantumRange</var> is the maximum integral
148 value which may be stored, per pixel, in the red, green, or blue channels of
149 the image. Each image pixel may also optionally (if the image matte channel is
150 enabled) have an associated level of opacity, ranging from <var>opaque</var> to
151 <var>transparent</var>, which may be used to determine the influence of the pixel
152 color when compositing the pixel with another image pixel. If the image matte
153 channel is disabled, then all pixels in the image are treated as opaque. The
154 color of an opaque pixel is fully visible while the color of a transparent
155 pixel color is entirely absent (pixel color is ignored).</p>
156
157 <p>By definition, raster images have a rectangular shape. All image rows are of
158 equal length, as are all image columns. By treating the alpha channel as a
159 visual "mask" the rectangular image may be given a "shape" by treating the
160 alpha channel as a cookie-cutter for the image. This is done by setting the
161 pixels within the shape to be opaque, with pixels outside the shape set as
162 transparent. Pixels on the boundary of the shape may be between opaque and
163 transparent in order to provide antialiasing (visually smooth edges). The
164 description of the composition operators use this concept of image "shape" in
165 order to make the description of the operators easier to understand. While it
166 is convenient to describe the operators in terms of "shapes" they are by no
167 means limited to mask-style operations since they are based on continuous
168 floating-point mathematics rather than simple boolean operations.</p>
169
170 <p>The following alpha blending (Duff-Porter) compose methods are available:</p>
171
172 <table class="table table-sm table-hover table-striped table-responsive">
173 <tbody>
174 <tr>
175 <th align="left" style="width: 8%">Method</th>
176 <th align="left">Description</th>
177 </tr>
178
179 <tr>
180 <td>clear</td>
181 <td>Both the color and the alpha of the destination are
182 cleared. Neither the source nor the destination are used (except for
183 destinations size and other meta-data which is always preserved.</td>
184 </tr>
185
186 <tr>
187 <td>src</td>
188 <td>The source is copied to the destination. The destination
189 is not used as input, though it is cleared.</td>
190 </tr>
191
192 <tr>
193 <td>dst</td>
194 <td>The destination is left untouched. The source image is
195 completely ignored.</td>
196 </tr>
197
198 <tr>
199 <td>src-over</td>
200 <td>The source is composited over the destination. this is
201 the default alpha blending compose method, when neither the compose
202 setting is set, nor is set in the image meta-data.</td>
203 </tr>
204
205 <tr>
206 <td>dst-over</td>
207 <td>The destination is composited over the source and the
208 result replaces the destination.</td>
209 </tr>
210
211 <tr>
212 <td>src-in</td>
213 <td>The part of the source lying inside of the destination
214 replaces the destination.</td>
215 </tr>
216
217 <tr>
218 <td>dst-in</td>
219 <td>The part of the destination lying inside of the source
220 replaces the destination. Areas not overlaid are cleared.</td>
221 </tr>
222
223 <tr>
224 <td>src-out</td>
225 <td>The part of the source lying outside of the destination
226 replaces the destination.</td>
227 </tr>
228
229 <tr>
230 <td>dst-out</td>
231 <td>The part of the destination lying outside of the source
232 replaces the destination.</td>
233 </tr>
234
235 <tr>
236 <td>src-atop</td>
237 <td>The part of the source lying inside of the destination is
238 composited onto the destination.</td>
239 </tr>
240
241 <tr>
242 <td>dst-atop</td>
243 <td>The part of the destination lying inside of the source is
244 composited over the source and replaces the destination. Areas not
245 overlaid are cleared. </td>
246 </tr>
247
248 <tr>
249 <td>xor</td>
250 <td>The part of the source that lies outside of the
251 destination is combined with the part of the destination that lies
252 outside of the source. Source or Destination, but not both. </td>
253 </tr>
254
255 </tbody>
256 </table>
257
258 <p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
259 For example the default compose method can be specified as just 'Over'.</p>
260
261 <p>Many of these compose methods will clear the destination image which was
262 not overlaid by the source image. This is to be expected as part of that
263 specific composition methods definition. You can disable this by setting the
264 special <a href="command-line-options.html#define"
265 >-define</a> 'compose:outside-overlay' to a value of 'false' will turn off
266 this behavior. </p>
267
268 <p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
269 related method '<samp>Copy</samp>' has been provided. This is equivalent to
270 using the '<samp>Src</samp>' with the special <a href="command-line-options.html#define"
271 >-define</a> option '<samp>compose:outside-overlay</samp>' set to
272 '<samp>false</samp>', so as to only modify the overlaid area, without clearing
273 the rest of the image outside the overlaid area. </p>
274
275 <p>The following mathematical composition methods are also available. </p>
276
277 <table class="table table-sm table-hover table-striped table-responsive">
278 <tbody>
279 <tr>
280 <th align="left" style="width: 8%">Method</th>
281 <th align="left">Description</th>
282 </tr>
283
284 <tr>
285 <td>multiply</td>
286 <td>The source is multiplied by the destination and replaces
287 the destination. The resultant color is always at least as dark as
288 either of the two constituent colors. Multiplying any color with black
289 produces black. Multiplying any color with white leaves the original
290 color unchanged.</td>
291 </tr>
292
293 <tr>
294 <td>screen</td>
295 <td>The source and destination are complemented and then
296 multiplied and then replace the destination. The resultant color is
297 always at least as light as either of the two constituent colors.
298 Screening any color with white produces white. Screening any color
299 with black leaves the original color unchanged.</td>
300 </tr>
301
302 <tr>
303 <td>plus</td>
304 <td>The source is added to the destination and replaces the
305 destination. This operator is useful for averaging or a controlled
306 merger of two images, rather than a direct overlay.</td>
307 </tr>
308
309 <tr>
310 <td>add</td>
311 <td>As per 'plus' but transparency data is treated as matte
312 values. As such any transparent areas in either image remain
313 transparent. </td>
314 </tr>
315
316 <tr>
317 <td>minus</td>
318 <td>Subtract the colors in the source image from the
319 destination image. When transparency is involved, opaque areas is
320 subtracted from any destination opaque areas. </td>
321 </tr>
322
323 <tr>
324 <td>subtract</td>
325 <td>Subtract the colors in the source image from the
326 destination image. When transparency is involved transparent areas are
327 subtracted, so only the opaque areas in the source remain opaque in
328 the destination image. </td>
329 </tr>
330
331 <tr>
332 <td>difference</td>
333 <td>Subtracts the darker of the two constituent colors from
334 the lighter. Painting with white inverts the destination color.
335 Painting with black produces no change.</td>
336 </tr>
337
338 <tr>
339 <td>exclusion</td>
340 <td>Produces an effect similar to that of 'difference', but
341 appears as lower contrast. Painting with white inverts the
342 destination color. Painting with black produces no change.</td>
343 </tr>
344
345 <tr>
346 <td>darken</td>
347 <td>Selects the darker of the destination and source colors.
348 The destination is replaced with the source when the source is darker,
349 otherwise it is left unchanged.</td>
350 </tr>
351
352 <tr>
353 <td>lighten</td>
354 <td>Selects the lighter of the destination and source colors.
355 The destination is replaced with the source when the source is
356 lighter, otherwise it is left unchanged. </td>
357 </tr>
358
359 <tr>
360 <td>negate</td>
361 <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>
362 </tr>
363
364 <tr>
365 <td>reflect</td>
366 <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>
367 </tr>
368
369 <tr>
370 <td>freeze</td>
371 <td>Another variation of reflect mode (base and blend color inverted, the result inverted again). </td>
372 </tr>
373
374 <tr>
375 <td>stamp</td>
376 <td>This mode somehow is similar to average mode. It is helpful when applying relief or bump textures to images. </td>
377 </tr>
378
379 <tr>
380 <td>interpolate</td>
381 <td>This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors). </td>
382 </tr>
383 </table>
384
385 <p>Typically these use the default 'Over' alpha blending when transparencies
386 are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
387 means the alpha channel of both images will only be used to ensure that any
388 visible input remains visible even in parts not overlaid. It also means that
389 any values are weighted by the alpha channel of the input and output images.
390 This 'Over' alpha blending is also applied to the lighting composition methods
391 below. </p>
392
393 <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
394 composition effects, becoming involved. </p>
395
396 <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>
397
398 <p>This define is not applied to the lighting composition methods (see below) even though they are closely related to mathematical composition methods.</p>
399
400 <p>The following lighting composition methods are also available. </p>
401
402 <table class="table table-sm table-hover table-striped table-responsive">
403 <tbody>
404 <tr>
405 <th align="left" style="width: 8%">Method</th>
406 <th align="left">Description</th>
407 </tr>
408
409 <tr>
410 <td>linear-dodge</td>
411 <td>This is equivalent to 'Plus' in that the color channels
412 are simply added, however it does not 'Plus' the alpha channel, but
413 uses the normal 'Over' alpha blending, which transparencies are
414 involved. Produces a sort of additive multiply-like result. </td>
415 </tr>
416
417 <tr>
418 <td>linear-burn</td>
419 <td>As 'Linear-Dodge', but also subtract one from the result.
420 Sort of a additive 'Screen' of the images. </td>
421 </tr>
422
423 <tr>
424 <td>color-dodge</td>
425 <td>Brightens the destination color to reflect the source
426 color. Painting with black produces no change.</td>
427 </tr>
428
429 <tr>
430 <td>color-burn</td>
431 <td>Darkens the destination color to reflect the source
432 color. Painting with white produces no change. </td>
433 </tr>
434
435 <tr>
436 <td>overlay</td>
437 <td>Multiplies or screens the colors, dependent on the
438 destination color. Source colors overlay the destination whilst
439 preserving its highlights and shadows. The destination color is not
440 replaced, but is mixed with the source color to reflect the lightness
441 or darkness of the destination.</td>
442 </tr>
443
444 <tr>
445 <td>hard-light</td>
446 <td>Multiplies or screens the colors, dependent on the source
447 color value. If the source color is lighter than 0.5, the destination
448 is lightened as if it were screened. If the source color is darker
449 than 0.5, the destination is darkened, as if it were multiplied. The
450 degree of lightening or darkening is proportional to the difference
451 between the source color and 0.5. If it is equal to 0.5 the
452 destination is unchanged. Painting with pure black or white produces
453 black or white.</td>
454 </tr>
455
456
457 <tr>
458 <td>linear-light</td>
459 <td>Like 'Hard-Light' but using linear-dodge and linear-burn
460 instead. Increases contrast slightly with an impact on the
461 foreground's tonal values.</td>
462 </tr>
463
464 <tr>
465 <td>soft-burn</td>
466 <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>
467 </tr>
468
469 <tr>
470 <td>soft-dodge</td>
471 <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>
472 </tr>
473
474 <tr>
475 <td>soft-light</td>
476 <td>Darkens or lightens the colors, dependent on the source
477 color value. If the source color is lighter than 0.5, the destination
478 is lightened. If the source color is darker than 0.5, the destination
479 is darkened, as if it were burned in. The degree of darkening or
480 lightening is proportional to the difference between the source color
481 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
482 with pure black or white produces a distinctly darker or lighter area,
483 but does not result in pure black or white. </td>
484 </tr>
485
486 <tr>
487 <td>pegtop-light</td>
488 <td>Almost equivalent to 'Soft-Light', but using a
489 continuous mathematical formula rather than two conditionally
490 selected formulae. </td>
491 </tr>
492
493 <tr>
494 <td>vivid-light</td>
495 <td>A modified 'Linear-Light' designed to preserve very strong
496 primary and secondary colors in the image. </td>
497 </tr>
498
499 <tr>
500 <td>pin-light</td>
501 <td>Similar to 'Hard-Light', but using sharp linear shadings,
502 to simulate the effects of a strong 'pinhole' light source. </td>
503 </tr>
504
505 </tbody>
506 </table>
507
508 <p>Also included are these special purpose compose methods:</p>
509
510 <table class="table table-sm table-hover table-striped table-responsive">
511 <tbody>
512 <tr>
513 <th align="left" style="width: 8%">Method</th>
514 <th align="left">Description</th>
515 </tr>
516
517 <tr>
518 <td>copy</td>
519 <td>This is equivalent to the Duff-Porter composition method
520 '<samp>Src,</samp>' but without clearing the parts of the destination
521 image that is not overlaid. </td>
522 </tr>
523
524 <tr>
525 <td>copy-*</td>
526 <td>Copy the specified channel (Red, Green, Blue, Cyan,
527 Magenta, Yellow, Black, or Opacity) in the source image to the
528 same channel in the destination image. If the channel specified
529 does not exist in the source image, (which can only happen for methods,
530 '<samp>copy-opacity</samp>' or '<samp>copy-black</samp>') then it is
531 assumed that the source image is a special grayscale channel image
532 of the values that is to be copied. </td>
533 </tr>
534
535 <tr>
536 <td>change-mask</td>
537 <td>Replace any destination pixel that is the similar to the
538 source images pixel (as defined by the current <a
539 href="command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
540 </td>
541 </tr>
542
543 <tr>
544 <td>stereo</td>
545 <td>create a stereo anaglyph</td>
546 </tr>
547 </tbody>
548 </table>
549
550 <p>On top of these composed methods are a few special ones that not only require
551 the two images that are being merged or overlaid, but have some extra numerical
552 arguments, which are tabled below. </p>
553
554 <p>In the "<samp>composite</samp>" command these composition methods are
555 selected using special options with the arguments needed. They are usually,
556 but not always, the same name as the composite 'method' they use, and replaces
557 the normal use of the <a href="command-line-options.html#compose" >-compose</a>
558 setting in the "<samp>composite</samp>" command. For example... </p>
559
560 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>composite ... -blend 50x50 ... </samp></pre>
561
562 <p>The "<samp>magick</samp>" command can accept these extra arguments to its <a href="command-line-options.html#composite"
563 >-composite</a> operator, using the special <a href="command-line-options.html#define">-define</a>
564 attribute of <samp>compose:args</samp>. This means you can now
565 make use of these special augmented <a href="command-line-options.html#compose"
566 >-compose</a> methods, those the argument and the method both need to be set
567 separately. For example... </p>
568
569 <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>
570
571 <p>The following is a table of these special 'argumented' compose methods,
572 with a brief summary of what they do. For more details see the equivalent
573 "composite" command option name. </p>
574
575 <table class="table table-sm table-hover table-striped table-responsive">
576 <tbody>
577 <tr>
578 <th align="left" style="width: 8%">Method</th>
579 <th align="left">Description</th>
580 </tr>
581
582 <tr>
583 <td>dissolve</td>
584 <td>Arguments:
585 <var>src_percent</var>[x<var>dst_percent</var>]
586 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#dissolve">-dissolve</a>.
587 Dissolve the 'source' image by the percentage given before overlaying
588 'over' the 'destination' image. If <var>src_percent</var> is
589 greater than 100, it starts dissolving the main image so it will
590 become transparent at a value of <samp>200</samp>. If
591 both percentages are given, each image are dissolved to the
592 percentages given.
593 </td>
594 </tr>
595
596 <tr>
597 <td>blend</td>
598 <td>Arguments:
599 <var>src_percent</var>[x<var>dst_percent</var>]
600 <br/>Equivalent to "<samp>composite</samp>" <a
601 href="command-line-options.html#blend">-blend</a>.
602 Average the images together ('plus') according to the percentages
603 given and each pixels transparency. If only a single percentage value
604 is given it sets the weight of the composite or 'source' image, while
605 the background image is weighted by the exact opposite amount. That is
606 a <samp>-blend 30</samp> merges 30% of the 'source' image with 70% of
607 the 'destination' image. Thus it is equivalent to <samp>-blend
608 30x70</samp>.
609 </td>
610 </tr>
611
612 <tr>
613 <td>mathematics</td>
614 <td>Arguments: <var>A, B, C, D</var>
615 <br/>Not available in "<samp>composite</samp>" at this time.
616 Merge the source and destination images according to the formula
617 <ul><samp>A*Sc*Dc + B*Sc + C*Dc + D</samp></ul>
618 Can be used to generate a custom composition method that would
619 otherwise need to be implemented using the slow <a
620 href="command-line-options.html#fx">-fx</a> DIY image operator.
621 </td>
622 </tr>
623
624 <tr>
625 <td>modulate</td>
626 <td>Arguments:
627 <var>brightness</var>[x<var>saturation</var>]
628 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#watermark">-watermark</a>.
629 Take a grayscale image (with alpha mask) and modify the destination
630 image's brightness according to watermark image's grayscale value and
631 the <var>brightness</var> percentage. The destinations
632 color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
633 (no color change).
634
635 </td>
636 </tr>
637
638 <tr>
639 <td>displace</td>
640 <td>Arguments:
641 <var>X-scale</var>[x<var>Y-scale</var>][!][%]
642 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#displace">-displace</a>.
643 With this option, the 'overlay' image, and optionally the 'mask'
644 image, is used as a relative displacement map, which is used to
645 displace the lookup of what part of the destination image is seen at
646 each point of the overlaid area. Much like the displacement map is a
647 'lens' that distorts the original 'background' image behind it.
648 <br/><br/>
649 The X-scale is modulated by the 'red' channel of the overlay image
650 while the Y-scale is modulated by the green channel, (the mask image
651 if given is rolled into green channel of the overlay image. This
652 separation allows you to modulate the X and Y lookup displacement
653 separately allowing you to do 2-dimensional displacements, rather
654 than 1-dimensional vectored displacements (using grayscale image).
655 <br/><br/>
656 If the overlay image contains transparency this is used as a mask
657 of the resulting image to remove 'invalid' pixels.
658 <br/><br/>
659 The '%' flag makes the displacement scale relative to the size of the
660 overlay image (100% = half width/height of image). Using '!' switches
661 percentage arguments to refer to the destination image size instead.
662 <br/><br/>
663 </td>
664 </tr>
665
666 <tr>
667 <td>distort</td>
668 <td>Arguments:
669 <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
670 <br/>Not available in "<samp>composite</samp>" at this time.
671 Exactly as per 'Displace' (above), but using absolute coordinates,
672 relative to the center of the overlay (or that given). Basically
673 allows you to generate absolute distortion maps where 'black' will
674 look up the left/top edge, and 'white' looks up the bottom/right
675 edge of the destination image, according to the scale given.
676 <br/><br/>
677 The '!' flag not only switches percentage scaling, to use the
678 destination image, but also the image the center offset of the lookup.
679 This means the overlay can lookup a completely different region of the
680 destination image.
681 <br/><br/>
682 </td>
683 </tr>
684
685 <tr>
686 <td>blur</td>
687 <td>Arguments:
688 <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
689 <br/>Equivalent to "<samp>composite</samp>" <a href="command-line-options.html#blur-composite">-blur</a>.
690 A Variable Blur Mapping Composition method, where each pixel in the
691 overlaid region is replaced with an Elliptical Weighted Average (EWA),
692 with an ellipse (typically a circle) of the given sigma size, scaled
693 according to overlay (source image) grayscale mapping.
694 <br/><br/>
695 As per 'Displace' and 'Distort', the red channel will modulate the
696 width of the ellipse, while the green channel will modulate the height
697 of the ellipse. If a single Angle value is given in the arguments,
698 then the ellipse will then be rotated by the angle specified.
699 <br/><br/>
700 Normally the blue channel of the mapping overlay image is ignored.
701 However if a second ellipse angle is given, then it is assumed that
702 the blue channel defines a variable angle for the ellipse ranging from
703 the first angle to the second angle given. This allows to generate
704 radial blurs, or a rough approximation for rotational blur. Or any mix
705 of the two.
706 <br/><br/>
707 </td>
708 </tr>
709 <tr>
710 <td>seamless-blend</td>
711 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
712 <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>
713 </td>
714 </tr>
715 <tr>
716 <td>saliency-blend</td>
717 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
718 <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>
719 </td>
720 </tr>
721
722
723 </tbody>
724 </table>
725
726 <p>To print a complete list of all the available compose operators, use <a
727 href="command-line-options.html#list">-list compose</a>.</p>
728 </div>
729 </div>
730 </main><!-- /.container -->
731 <footer class="text-center pt-5 my-5 text-body-secondary border-top">
732 <div class="container-fluid">
733 <a href="security-policy.html">Security</a> •
734 <a href="news.html">News</a>
735
736 <a href="#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
737
738 <a href="links.html">Related</a> •
739 <a href="sitemap.html">Sitemap</a>
740 <br/>
741 <a href="support.html">Sponsor</a> •
742 <a href="cite.html">Cite</a> •
743 <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
744 <a href="../www/../www/../www/../www/https://imagemagick.org/script/contact.php">Contact Us</a>
745 <br/>
746 <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> •
747 <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>
748 <br/>
749 <small>Copyright © 1999 ImageMagick Studio LLC</small>
750 </div>
751 </footer>
752 </div>
753
754 <!-- Javascript assets -->
755 <script src="assets/bootstrap.bundle.min.js" ></script>
756 </body>
757 </html>
758 <!-- Magick Cache 1st March 2025 18:53 -->