Debian Codegraph @

www/compose/index.html

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1
2
3 <!DOCTYPE html>
4 <html lang="en" data-bs-theme="dark">
5
6
7 <head>
8 <meta charset="utf-8">
9 <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
10 <title>ImageMagick | Alpha Compositing</title>
11 <meta name="description" content="">
12 <link rel="canonical" href="index.html">
13 <meta name="robots" content="index, follow">
14 <meta name="theme-color" content="#000000">
15 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4">
16 <link rel="shortcut icon" href="../image/wand.png" type="image/png">
17 <link rel="apple-touch-icon" href="../image/wand.png" type="image/png">
18 <link rel="preconnect" href="https://localhost/">
19 <link rel="preload" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" as="style" crossorigin="anonymous">
20 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" crossorigin="anonymous">
21 <!-- Accessibility Enhancement -->
22 <style>
23 html {
24 scroll-padding-top: 70px;
25 }
26
27 a.nav-link:hover,
28 a.dropdown-item:hover {
29 color: #ffc107 !important;
30 text-shadow: 0px 2px 4px rgba(255, 193, 7, 0.8);
31 }
32
33 .btn-outline-warning {
34 color: #cd7f32;
35 border-color: #cd7f32;
36 }
37
38 .navbar-brand {
39 color: #d4af37;
40 transition: color 0.3s ease, text-shadow 0.3s ease;
41 }
42
43 .navbar-brand:hover {
44 color: #e9c03d;
45 text-shadow: 0px 2px 4px rgba(203, 163, 120, 0.6);
46 }
47
48 :root {
49 --bs-code-color: revert;
50 }
51 </style>
52 <!-- Open Graph Meta Tags -->
53 <meta property="og:title" content="ImageMagick | Alpha Compositing">
54 <meta property="og:description" content="">
55 <meta property="og:image" content="https://imagemagick.org/image/logo.png">
56 <meta property="og:logo" content="https://imagemagick.org/image/logo.png">
57 <meta property="og:url" content="https://imagemagick.org/compose/">
58 <meta property="og:type" content="website">
59 <meta property="og:site_name" content="ImageMagick">
60 <meta property="og:locale" content="en_us">
61 <!-- Twitter Card Meta Tags -->
62 <meta name="twitter:card" content="summary_large_image">
63 $site=strtolower("ImageMagick");
64 <meta name="twitter:site" content="@imagemagick">
65 <meta name="twitter:creator" content="@imagemagick">
66 <meta name="twitter:title" content="ImageMagick | Alpha Compositing">
67 <meta name="twitter:description" content="$this->description">
68 <meta name="twitter:image" content="https://imagemagick.org/image/logo.png">
69 <meta name="twitter:image:alt" content="ImageMagick logo and tag line">
70 <!-- JSON-LD Structured Data -->
71 <script type="application/ld+json">
72 {
73 "@context": "https://schema.org",
74 "@type": "SoftwareApplication",
75 "name": "ImageMagick",
76 "url": "ImageMagick | Alpha Compositing",
77 "image": "https://imagemagick.org/image/logo.png",
78 "description": "$this->description",
79 "applicationCategory": "Multimedia",
80 "operatingSystem": "Windows, macOS, Linux, Unix",
81 "softwareVersion": "7.1.2-27",
82 "license": "https://imagemagick.org/license/",
83 "creator": {
84 "@type": "Organization",
85 "name": "ImageMagick Studio LLC",
86 "url": "https://imagemagick.org"
87 },
88 "keywords": [
89 "".ucfirst($title)."",
90 "image processing software",
91 "image conversion tool",
92 "batch image editing",
93 "open-source image editor",
94 "ImageMagick command-line",
95 "resize images ImageMagick",
96 "crop and rotate images",
97 "ImageMagick tutorial",
98 "ImageMagick automation",
99 "ImageMagick for developers",
100 "ImageMagick CLI",
101 "ImageMagick filters and effects",
102 "ImageMagick scripting",
103 "ImageMagick API integration"
104 ],
105 "sameAs": [
106 "https://github.com/ImageMagick",
107 "https://x.com/imagemagick"
108 ],
109 "offers": {
110 "@type": "Offer",
111 "price": "0.00",
112 "priceCurrency": "USD"
113 }
114 }
115 </script>
116 <!-- Google Custom Search -->
117 <script async src="https://localhost/cse.js?cx=8720b81722164487b"></script>
118 <script async src="https://localhost/pagead/js/adsbygoogle.js?client=ca-pub-3129977114552745" crossorigin="anonymous"></script>
119 </head>
120
121 <body>
122 <script>
123 function setTheme(theme) {
124 localStorage.setItem('theme', theme);
125 updateThemeIcon(theme);
126 document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? getSystemTheme() : theme);
127 }
128 function getSystemTheme() {
129 return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
130 }
131 function updateThemeIcon(theme) {
132 const iconMap = {
133 light: '☀️',
134 dark: '🌙',
135 auto: '🌓'
136 };
137 document.getElementById('currentThemeIcon').textContent = iconMap[theme] || '🌓';
138 }
139 document.addEventListener('DOMContentLoaded', () => {
140 const savedTheme = localStorage.getItem('theme') || 'auto';
141 setTheme(savedTheme);
142 });
143 </script>
144 <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
145 <div class="container-fluid">
146 <a class="navbar-brand fw-bold" href="../index-2.html" title="ImageMagick">ImageMagick</a>
147 <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">
148 <span class="navbar-toggler-icon"></span>
149 </button>
150
151 <div class="collapse navbar-collapse" id="magick-navbars">
152 <ul class="navbar-nav me-auto">
153 <li class="nav-item">
154 <a class="nav-link "" href="../download/index.html">Download</a>
155 </li>
156 <li class="nav-item">
157 <a class="nav-link "" href="../command-line-tools/index.html">Tools</a>
158 </li>
159 <li class="nav-item">
160 <a class="nav-link "" href="../command-line-processing/index.html">CLI</a>
161 </li>
162 <li class="nav-item">
163 <a class="nav-link "" href="../develop/index.html">Develop</a>
164 </li>
165 <li class="nav-item">
166 <a class="nav-link" rel="noopener noreferrer" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
167 </li>
168 </ul>
169 <ul class="navbar-nav ms-auto">
170 <li class="nav-item ms-3">
171 <form class="d-flex form-inline" action="https://imagemagick.org/compose/">
172 <input class="form-control me-2" type="text" name="q" placeholder="Search site..." aria-label="Search">
173 <button class="btn btn-outline-warning" type="submit" name="sa">Search</button>
174 </form>
175 </li>
176 <li class="nav-item dropdown ms-3">
177 <a class="nav-link dropdown-toggle" href="#" id="themeDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
178 <span id="currentThemeIcon">🌓</span>
179 </a>
180 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="themeDropdown">
181 <li><a class="dropdown-item" href="#" onclick="setTheme('light')">☀️ Light</a></li>
182 <li><a class="dropdown-item" href="#" onclick="setTheme('dark')">🌙 Dark</a></li>
183 <li><a class="dropdown-item" href="#" onclick="setTheme('auto')">🌓 Auto</a></li>
184 </ul>
185 </li>
186 </ul>
187 </div>
188 </div>
189 </nav>
190
191 <div class="col-lg-8 mx-auto text-body-secondary pt-5 pt-lg-5">
192 <header class="d-flex align-items-center pb-3 mb-5 border-bottom">
193 <div class="mt-3 ms-3">
194 <a href="../index-2.html" class="text-decoration-none">
195 <h1 class="fs-2 mb-1 display-5">Alpha Compositing</h1>
196 </a>
197 <h2 class="fs-5 text-muted h4">ImageMagick</h2>
198 </div>
199 </header>
200
201 <main role="main" class="container">
202 <div class="row g-5">
203 <div class="col-md-9">
204 <div>
205 <div id="cli-examples"></div>
206
207 <p class="lead">This page described the Image composition methods that is used to define how
208 two images should be merged together in various image operations. For the
209 Command Line API it is typically set using the <a
210 href="../command-line-options/index.html#compose" >-compose</a> setting option. </p>
211
212
213 <p>The description of composition uses abstract terminology in order to allow
214 the description to be more precise, while avoiding constant values which are
215 specific to a particular build configuration. Each image pixel is represented
216 by red, green, and blue levels (which are equal for a gray pixel). The
217 build-dependent value <var>QuantumRange</var> is the maximum integral
218 value which may be stored, per pixel, in the red, green, or blue channels of
219 the image. Each image pixel may also optionally (if the image matte channel is
220 enabled) have an associated level of opacity, ranging from <var>opaque</var> to
221 <var>transparent</var>, which may be used to determine the influence of the pixel
222 color when compositing the pixel with another image pixel. If the image matte
223 channel is disabled, then all pixels in the image are treated as opaque. The
224 color of an opaque pixel is fully visible while the color of a transparent
225 pixel color is entirely absent (pixel color is ignored).</p>
226
227 <p>By definition, raster images have a rectangular shape. All image rows are of
228 equal length, as are all image columns. By treating the alpha channel as a
229 visual "mask" the rectangular image may be given a "shape" by treating the
230 alpha channel as a cookie-cutter for the image. This is done by setting the
231 pixels within the shape to be opaque, with pixels outside the shape set as
232 transparent. Pixels on the boundary of the shape may be between opaque and
233 transparent in order to provide antialiasing (visually smooth edges). The
234 description of the composition operators use this concept of image "shape" in
235 order to make the description of the operators easier to understand. While it
236 is convenient to describe the operators in terms of "shapes" they are by no
237 means limited to mask-style operations since they are based on continuous
238 floating-point mathematics rather than simple boolean operations.</p>
239
240 <p>The following alpha blending (Duff-Porter) compose methods are available:</p>
241
242 <table class="table table-sm table-hover table-striped table-responsive">
243 <tbody>
244 <tr>
245 <th align="left" style="width: 8%">Method</th>
246 <th align="left">Description</th>
247 </tr>
248
249 <tr>
250 <td>clear</td>
251 <td>Both the color and the alpha of the destination are
252 cleared. Neither the source nor the destination are used (except for
253 destinations size and other meta-data which is always preserved.</td>
254 </tr>
255
256 <tr>
257 <td>src</td>
258 <td>The source is copied to the destination. The destination
259 is not used as input, though it is cleared.</td>
260 </tr>
261
262 <tr>
263 <td>dst</td>
264 <td>The destination is left untouched. The source image is
265 completely ignored.</td>
266 </tr>
267
268 <tr>
269 <td>src-over</td>
270 <td>The source is composited over the destination. this is
271 the default alpha blending compose method, when neither the compose
272 setting is set, nor is set in the image meta-data.</td>
273 </tr>
274
275 <tr>
276 <td>dst-over</td>
277 <td>The destination is composited over the source and the
278 result replaces the destination.</td>
279 </tr>
280
281 <tr>
282 <td>src-in</td>
283 <td>The part of the source lying inside of the destination
284 replaces the destination.</td>
285 </tr>
286
287 <tr>
288 <td>dst-in</td>
289 <td>The part of the destination lying inside of the source
290 replaces the destination. Areas not overlaid are cleared.</td>
291 </tr>
292
293 <tr>
294 <td>src-out</td>
295 <td>The part of the source lying outside of the destination
296 replaces the destination.</td>
297 </tr>
298
299 <tr>
300 <td>dst-out</td>
301 <td>The part of the destination lying outside of the source
302 replaces the destination.</td>
303 </tr>
304
305 <tr>
306 <td>src-atop</td>
307 <td>The part of the source lying inside of the destination is
308 composited onto the destination.</td>
309 </tr>
310
311 <tr>
312 <td>dst-atop</td>
313 <td>The part of the destination lying inside of the source is
314 composited over the source and replaces the destination. Areas not
315 overlaid are cleared. </td>
316 </tr>
317
318 <tr>
319 <td>xor</td>
320 <td>The part of the source that lies outside of the
321 destination is combined with the part of the destination that lies
322 outside of the source. Source or Destination, but not both. </td>
323 </tr>
324
325 </tbody>
326 </table>
327
328 <p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
329 For example the default compose method can be specified as just 'Over'.</p>
330
331 <p>Many of these compose methods will clear the destination image which was
332 not overlaid by the source image. This is to be expected as part of that
333 specific composition methods definition. You can disable this by setting the
334 special <a href="../command-line-options/index.html#define"
335 >-define</a> 'compose:outside-overlay' to a value of 'false' will turn off
336 this behavior. </p>
337
338 <p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
339 related method '<code>Copy</code>' has been provided. This is equivalent to
340 using the '<code>Src</code>' with the special <a href="../command-line-options/index.html#define"
341 >-define</a> option '<code>compose:outside-overlay</code>' set to
342 '<code>false</code>', so as to only modify the overlaid area, without clearing
343 the rest of the image outside the overlaid area. </p>
344
345 <p>The following mathematical composition methods are also available. </p>
346
347 <table class="table table-sm table-hover table-striped table-responsive">
348 <tbody>
349 <tr>
350 <th align="left" style="width: 8%">Method</th>
351 <th align="left">Description</th>
352 </tr>
353
354 <tr>
355 <td>multiply</td>
356 <td>The source is multiplied by the destination and replaces
357 the destination. The resultant color is always at least as dark as
358 either of the two constituent colors. Multiplying any color with black
359 produces black. Multiplying any color with white leaves the original
360 color unchanged.</td>
361 </tr>
362
363 <tr>
364 <td>screen</td>
365 <td>The source and destination are complemented and then
366 multiplied and then replace the destination. The resultant color is
367 always at least as light as either of the two constituent colors.
368 Screening any color with white produces white. Screening any color
369 with black leaves the original color unchanged.</td>
370 </tr>
371
372 <tr>
373 <td>plus</td>
374 <td>The source is added to the destination and replaces the
375 destination. This operator is useful for averaging or a controlled
376 merger of two images, rather than a direct overlay.</td>
377 </tr>
378
379 <tr>
380 <td>add</td>
381 <td>As per 'plus' but transparency data is treated as matte
382 values. As such any transparent areas in either image remain
383 transparent. </td>
384 </tr>
385
386 <tr>
387 <td>minus</td>
388 <td>Subtract the colors in the source image from the
389 destination image. When transparency is involved, opaque areas is
390 subtracted from any destination opaque areas. </td>
391 </tr>
392
393 <tr>
394 <td>subtract</td>
395 <td>Subtract the colors in the source image from the
396 destination image. When transparency is involved transparent areas are
397 subtracted, so only the opaque areas in the source remain opaque in
398 the destination image. </td>
399 </tr>
400
401 <tr>
402 <td>difference</td>
403 <td>Subtracts the darker of the two constituent colors from
404 the lighter. Painting with white inverts the destination color.
405 Painting with black produces no change.</td>
406 </tr>
407
408 <tr>
409 <td>exclusion</td>
410 <td>Produces an effect similar to that of 'difference', but
411 appears as lower contrast. Painting with white inverts the
412 destination color. Painting with black produces no change.</td>
413 </tr>
414
415 <tr>
416 <td>darken</td>
417 <td>Selects the darker of the destination and source colors.
418 The destination is replaced with the source when the source is darker,
419 otherwise it is left unchanged.</td>
420 </tr>
421
422 <tr>
423 <td>lighten</td>
424 <td>Selects the lighter of the destination and source colors.
425 The destination is replaced with the source when the source is
426 lighter, otherwise it is left unchanged. </td>
427 </tr>
428
429 <tr>
430 <td>negate</td>
431 <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>
432 </tr>
433
434 <tr>
435 <td>reflect</td>
436 <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>
437 </tr>
438
439 <tr>
440 <td>freeze</td>
441 <td>Another variation of reflect mode (base and blend color inverted, the result inverted again). </td>
442 </tr>
443
444 <tr>
445 <td>stamp</td>
446 <td>This mode somehow is similar to average mode. It is helpful when applying relief or bump textures to images. </td>
447 </tr>
448
449 <tr>
450 <td>interpolate</td>
451 <td>This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors). </td>
452 </tr>
453 </table>
454
455 <p>Typically these use the default 'Over' alpha blending when transparencies
456 are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
457 means the alpha channel of both images will only be used to ensure that any
458 visible input remains visible even in parts not overlaid. It also means that
459 any values are weighted by the alpha channel of the input and output images.
460 This 'Over' alpha blending is also applied to the lighting composition methods
461 below. </p>
462
463 <p> The math composition is applied on an individual channel basis as defined by the <a href="../command-line-options/index.html#channel" >-channel</a>. This includes the alpha channel. This special usage allows you to perform true mathematics of the image channels, without alpha
464 composition effects, becoming involved. </p>
465
466 <p>Use <code>-define compose:sync=false</code> 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/index.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>
467
468 <p>This define is not applied to the lighting composition methods (see below) even though they are closely related to mathematical composition methods.</p>
469
470 <p>The following lighting composition methods are also available. </p>
471
472 <table class="table table-sm table-hover table-striped table-responsive">
473 <tbody>
474 <tr>
475 <th align="left" style="width: 8%">Method</th>
476 <th align="left">Description</th>
477 </tr>
478
479 <tr>
480 <td>linear-dodge</td>
481 <td>This is equivalent to 'Plus' in that the color channels
482 are simply added, however it does not 'Plus' the alpha channel, but
483 uses the normal 'Over' alpha blending, which transparencies are
484 involved. Produces a sort of additive multiply-like result. </td>
485 </tr>
486
487 <tr>
488 <td>linear-burn</td>
489 <td>As 'Linear-Dodge', but also subtract one from the result.
490 Sort of a additive 'Screen' of the images. </td>
491 </tr>
492
493 <tr>
494 <td>color-dodge</td>
495 <td>Brightens the destination color to reflect the source
496 color. Painting with black produces no change.</td>
497 </tr>
498
499 <tr>
500 <td>color-burn</td>
501 <td>Darkens the destination color to reflect the source
502 color. Painting with white produces no change. </td>
503 </tr>
504
505 <tr>
506 <td>overlay</td>
507 <td>Multiplies or screens the colors, dependent on the
508 destination color. Source colors overlay the destination whilst
509 preserving its highlights and shadows. The destination color is not
510 replaced, but is mixed with the source color to reflect the lightness
511 or darkness of the destination.</td>
512 </tr>
513
514 <tr>
515 <td>hard-light</td>
516 <td>Multiplies or screens the colors, dependent on the source
517 color value. If the source color is lighter than 0.5, the destination
518 is lightened as if it were screened. If the source color is darker
519 than 0.5, the destination is darkened, as if it were multiplied. The
520 degree of lightening or darkening is proportional to the difference
521 between the source color and 0.5. If it is equal to 0.5 the
522 destination is unchanged. Painting with pure black or white produces
523 black or white.</td>
524 </tr>
525
526
527 <tr>
528 <td>linear-light</td>
529 <td>Like 'Hard-Light' but using linear-dodge and linear-burn
530 instead. Increases contrast slightly with an impact on the
531 foreground's tonal values.</td>
532 </tr>
533
534 <tr>
535 <td>soft-burn</td>
536 <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>
537 </tr>
538
539 <tr>
540 <td>soft-dodge</td>
541 <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>
542 </tr>
543
544 <tr>
545 <td>soft-light</td>
546 <td>Darkens or lightens the colors, dependent on the source
547 color value. If the source color is lighter than 0.5, the destination
548 is lightened. If the source color is darker than 0.5, the destination
549 is darkened, as if it were burned in. The degree of darkening or
550 lightening is proportional to the difference between the source color
551 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
552 with pure black or white produces a distinctly darker or lighter area,
553 but does not result in pure black or white. </td>
554 </tr>
555
556 <tr>
557 <td>pegtop-light</td>
558 <td>Almost equivalent to 'Soft-Light', but using a
559 continuous mathematical formula rather than two conditionally
560 selected formulae. </td>
561 </tr>
562
563 <tr>
564 <td>vivid-light</td>
565 <td>A modified 'Linear-Light' designed to preserve very strong
566 primary and secondary colors in the image. </td>
567 </tr>
568
569 <tr>
570 <td>pin-light</td>
571 <td>Similar to 'Hard-Light', but using sharp linear shadings,
572 to simulate the effects of a strong 'pinhole' light source. </td>
573 </tr>
574
575 </tbody>
576 </table>
577
578 <p>Also included are these special purpose compose methods:</p>
579
580 <table class="table table-sm table-hover table-striped table-responsive">
581 <tbody>
582 <tr>
583 <th align="left" style="width: 8%">Method</th>
584 <th align="left">Description</th>
585 </tr>
586
587 <tr>
588 <td>copy</td>
589 <td>This is equivalent to the Duff-Porter composition method
590 '<code>Src,</code>' but without clearing the parts of the destination
591 image that is not overlaid. </td>
592 </tr>
593
594 <tr>
595 <td>copy-*</td>
596 <td>Copy the specified channel (Red, Green, Blue, Cyan,
597 Magenta, Yellow, Black, or Opacity) in the source image to the
598 same channel in the destination image. If the channel specified
599 does not exist in the source image, (which can only happen for methods,
600 '<code>copy-opacity</code>' or '<code>copy-black</code>') then it is
601 assumed that the source image is a special grayscale channel image
602 of the values that is to be copied. </td>
603 </tr>
604
605 <tr>
606 <td>change-mask</td>
607 <td>Replace any destination pixel that is the similar to the
608 source images pixel (as defined by the current <a
609 href="../command-line-options/index.html#fuzz">-fuzz</a> factor), with transparency.
610 </td>
611 </tr>
612
613 <tr>
614 <td>stereo</td>
615 <td>create a stereo anaglyph</td>
616 </tr>
617 </tbody>
618 </table>
619
620 <p>On top of these composed methods are a few special ones that not only require
621 the two images that are being merged or overlaid, but have some extra numerical
622 arguments, which are tabled below. </p>
623
624 <p>In the "<code>composite</code>" command these composition methods are
625 selected using special options with the arguments needed. They are usually,
626 but not always, the same name as the composite 'method' they use, and replaces
627 the normal use of the <a href="../command-line-options/index.html#compose" >-compose</a>
628 setting in the "<code>composite</code>" command. For example... </p>
629
630 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><code>composite ... -blend 50x50 ... </code></pre>
631
632 <p>The "<samp>$ magick</samp>" command can accept these extra arguments to its <a href="../command-line-options/index.html#composite"
633 >-composite</a> operator, using the special <a href="../command-line-options/index.html#define">-define</a>
634 attribute of <code>compose:args</code>. This means you can now
635 make use of these special augmented <a href="../command-line-options/index.html#compose"
636 >-compose</a> methods, those the argument and the method both need to be set
637 separately. For example... </p>
638
639 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary cli"><pre><samp>$ magick ... -compose blend -define compose:args=50,50 -composite ... </samp></pre></pre>
640
641 <p>The following is a table of these special 'argumented' compose methods,
642 with a brief summary of what they do. For more details see the equivalent
643 "composite" command option name. </p>
644
645 <table class="table table-sm table-hover table-striped table-responsive">
646 <tbody>
647 <tr>
648 <th align="left" style="width: 8%">Method</th>
649 <th align="left">Description</th>
650 </tr>
651
652 <tr>
653 <td>dissolve</td>
654 <td>Arguments:
655 <var>src_percent</var>[x<var>dst_percent</var>]
656 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#dissolve">-dissolve</a>.
657 Dissolve the 'source' image by the percentage given before overlaying
658 'over' the 'destination' image. If <var>src_percent</var> is
659 greater than 100, it starts dissolving the main image so it will
660 become transparent at a value of <code>200</code>. If
661 both percentages are given, each image are dissolved to the
662 percentages given.
663 </td>
664 </tr>
665
666 <tr>
667 <td>blend</td>
668 <td>Arguments:
669 <var>src_percent</var>[x<var>dst_percent</var>]
670 <br/>Equivalent to "<code>composite</code>" <a
671 href="../command-line-options/index.html#blend">-blend</a>.
672 Average the images together ('plus') according to the percentages
673 given and each pixels transparency. If only a single percentage value
674 is given it sets the weight of the composite or 'source' image, while
675 the background image is weighted by the exact opposite amount. That is
676 a <code>-blend 30</code> merges 30% of the 'source' image with 70% of
677 the 'destination' image. Thus it is equivalent to <code>-blend
678 30x70</code>.
679 </td>
680 </tr>
681
682 <tr>
683 <td>mathematics</td>
684 <td>Arguments: <var>A, B, C, D</var>
685 <br/>Not available in "<code>composite</code>" at this time.
686 Merge the source and destination images according to the formula
687 <ul><code>A*Sc*Dc + B*Sc + C*Dc + D</code></ul>
688 Can be used to generate a custom composition method that would
689 otherwise need to be implemented using the slow <a
690 href="../command-line-options/index.html#fx">-fx</a> DIY image operator.
691 </td>
692 </tr>
693
694 <tr>
695 <td>modulate</td>
696 <td>Arguments:
697 <var>brightness</var>[x<var>saturation</var>]
698 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#watermark">-watermark</a>.
699 Take a grayscale image (with alpha mask) and modify the destination
700 image's brightness according to watermark image's grayscale value and
701 the <var>brightness</var> percentage. The destinations
702 color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
703 (no color change).
704
705 </td>
706 </tr>
707
708 <tr>
709 <td>displace</td>
710 <td>Arguments:
711 <var>X-scale</var>[x<var>Y-scale</var>][!][%]
712 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#displace">-displace</a>.
713 With this option, the 'overlay' image, and optionally the 'mask'
714 image, is used as a relative displacement map, which is used to
715 displace the lookup of what part of the destination image is seen at
716 each point of the overlaid area. Much like the displacement map is a
717 'lens' that distorts the original 'background' image behind it.
718 <br/><br/>
719 The X-scale is modulated by the 'red' channel of the overlay image
720 while the Y-scale is modulated by the green channel, (the mask image
721 if given is rolled into green channel of the overlay image. This
722 separation allows you to modulate the X and Y lookup displacement
723 separately allowing you to do 2-dimensional displacements, rather
724 than 1-dimensional vectored displacements (using grayscale image).
725 <br/><br/>
726 If the overlay image contains transparency this is used as a mask
727 of the resulting image to remove 'invalid' pixels.
728 <br/><br/>
729 The '%' flag makes the displacement scale relative to the size of the
730 overlay image (100% = half width/height of image). Using '!' switches
731 percentage arguments to refer to the destination image size instead.
732 <br/><br/>
733 </td>
734 </tr>
735
736 <tr>
737 <td>distort</td>
738 <td>Arguments:
739 <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
740 <br/>Not available in "<code>composite</code>" at this time.
741 Exactly as per 'Displace' (above), but using absolute coordinates,
742 relative to the center of the overlay (or that given). Basically
743 allows you to generate absolute distortion maps where 'black' will
744 look up the left/top edge, and 'white' looks up the bottom/right
745 edge of the destination image, according to the scale given.
746 <br/><br/>
747 The '!' flag not only switches percentage scaling, to use the
748 destination image, but also the image the center offset of the lookup.
749 This means the overlay can lookup a completely different region of the
750 destination image.
751 <br/><br/>
752 </td>
753 </tr>
754
755 <tr>
756 <td>blur</td>
757 <td>Arguments:
758 <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
759 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#blur-composite">-blur</a>.
760 A Variable Blur Mapping Composition method, where each pixel in the
761 overlaid region is replaced with an Elliptical Weighted Average (EWA),
762 with an ellipse (typically a circle) of the given sigma size, scaled
763 according to overlay (source image) grayscale mapping.
764 <br/><br/>
765 As per 'Displace' and 'Distort', the red channel will modulate the
766 width of the ellipse, while the green channel will modulate the height
767 of the ellipse. If a single Angle value is given in the arguments,
768 then the ellipse will then be rotated by the angle specified.
769 <br/><br/>
770 Normally the blue channel of the mapping overlay image is ignored.
771 However if a second ellipse angle is given, then it is assumed that
772 the blue channel defines a variable angle for the ellipse ranging from
773 the first angle to the second angle given. This allows to generate
774 radial blurs, or a rough approximation for rotational blur. Or any mix
775 of the two.
776 <br/><br/>
777 </td>
778 </tr>
779 <tr>
780 <td>seamless-blend</td>
781 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
782 <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>
783 </td>
784 </tr>
785 <tr>
786 <td>saliency-blend</td>
787 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
788 <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>
789 </td>
790 </tr>
791
792
793 </tbody>
794 </table>
795
796 <p>To print a complete list of all the available compose operators, use <a
797 href="../command-line-options/index.html#list">-list compose</a>.</p>
798 </div>
799
800 </div>
801 <div class="col-md-3">
802 <div class="container text-center my-3">
803 <a href="../image/wizard.png" rel="noopener noreferrer" target="_blank">
804 <img alt="The Tao of the Spiritual Warrior" class="img-fluid img-thumbnail" height="1468" loading="lazy" src="../image/wizard.png" width="1104">
805 </a>
806 <p class="mt-2"><iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe></p>
807 </div>
808 <div class="container text-center my-3">
809 <script async src="https://localhost/pagead/js/adsbygoogle.js?client=ca-pub-3129977114552745"
810 crossorigin="anonymous"></script>
811 <!-- Banner Ad -->
812 <ins class="adsbygoogle"
813 style="display:block"
814 data-ad-client="ca-pub-3129977114552745"
815 data-ad-slot="1083537442"
816 data-ad-format="auto"
817 data-full-width-responsive="true"></ins>
818 <script>
819 (adsbygoogle = window.adsbygoogle || []).push({});
820 </script>
821 </div>
822 </div>
823 </div>
824 <a aria-label="About ImageMagick" class="btn btn-outline-warning mt-3" href="../index-2.html">About ImageMagick</a>
825 </main><!-- /.container -->
826 <footer class="text-center pt-5 my-5 text-body-secondary border-top">
827 <div class="container-fluid">
828 <a href="../security-policy/index.html">Security</a> •
829 <a href="../news/index.html">News</a>
830 &nbsp;
831 <a href="#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../image/wand.ico"></a>
832 &nbsp;
833 <a href="../links/index.html">Related</a> •
834 <a href="../sitemap/index.html">Sitemap</a>
835 <br>
836 <a href="../support/index.html">Sponsor</a> •
837 <a href="../cite/index.html">Cite</a> •
838 <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
839 <a href="https://github.com/ImageMagick/ImageMagick/discussions">Contact Us</a>
840 <br>
841 <a href="https://github.com/imagemagick/imagemagick" rel="noopener noreferrer" 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">
842 <title>GitHub</title>
843 <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" />
844 </svg></a> •
845 <a href="https://twitter.com/imagemagick" rel="noopener noreferrer" 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">
846 <title>Twitter</title>
847 <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" />
848 </svg></a>
849 <br>
850 <small>Copyright © 1999 ImageMagick Studio LLC</small>
851 </div>
852 </footer>
853 <div style="visibility: hidden;">
854 <div class="gcse-search"></div>
855 </div>
856 </div>
857
858 <!-- Javascript assets -->
859 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
860 </body>
861
862
863 </html>