Debian Codegraph @

www/compose/index.html

raw symbols ◀ ▶ SCIP
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="true" src="https://localhost/cse.js?cx=8720b81722164487b"></script>
118 <script async="true" 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 </tbody>
454 </table>
455
456 <p>Typically these use the default 'Over' alpha blending when transparencies
457 are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
458 means the alpha channel of both images will only be used to ensure that any
459 visible input remains visible even in parts not overlaid. It also means that
460 any values are weighted by the alpha channel of the input and output images.
461 This 'Over' alpha blending is also applied to the lighting composition methods
462 below. </p>
463
464 <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
465 composition effects, becoming involved. </p>
466
467 <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>
468
469 <p>This define is not applied to the lighting composition methods (see below) even though they are closely related to mathematical composition methods.</p>
470
471 <p>The following lighting composition methods are also available. </p>
472
473 <table class="table table-sm table-hover table-striped table-responsive">
474 <tbody>
475 <tr>
476 <th align="left" style="width: 8%">Method</th>
477 <th align="left">Description</th>
478 </tr>
479
480 <tr>
481 <td>linear-dodge</td>
482 <td>This is equivalent to 'Plus' in that the color channels
483 are simply added, however it does not 'Plus' the alpha channel, but
484 uses the normal 'Over' alpha blending, which transparencies are
485 involved. Produces a sort of additive multiply-like result. </td>
486 </tr>
487
488 <tr>
489 <td>linear-burn</td>
490 <td>As 'Linear-Dodge', but also subtract one from the result.
491 Sort of a additive 'Screen' of the images. </td>
492 </tr>
493
494 <tr>
495 <td>color-dodge</td>
496 <td>Brightens the destination color to reflect the source
497 color. Painting with black produces no change.</td>
498 </tr>
499
500 <tr>
501 <td>color-burn</td>
502 <td>Darkens the destination color to reflect the source
503 color. Painting with white produces no change. </td>
504 </tr>
505
506 <tr>
507 <td>overlay</td>
508 <td>Multiplies or screens the colors, dependent on the
509 destination color. Source colors overlay the destination whilst
510 preserving its highlights and shadows. The destination color is not
511 replaced, but is mixed with the source color to reflect the lightness
512 or darkness of the destination.</td>
513 </tr>
514
515 <tr>
516 <td>hard-light</td>
517 <td>Multiplies or screens the colors, dependent on the source
518 color value. If the source color is lighter than 0.5, the destination
519 is lightened as if it were screened. If the source color is darker
520 than 0.5, the destination is darkened, as if it were multiplied. The
521 degree of lightening or darkening is proportional to the difference
522 between the source color and 0.5. If it is equal to 0.5 the
523 destination is unchanged. Painting with pure black or white produces
524 black or white.</td>
525 </tr>
526
527
528 <tr>
529 <td>linear-light</td>
530 <td>Like 'Hard-Light' but using linear-dodge and linear-burn
531 instead. Increases contrast slightly with an impact on the
532 foreground's tonal values.</td>
533 </tr>
534
535 <tr>
536 <td>soft-burn</td>
537 <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>
538 </tr>
539
540 <tr>
541 <td>soft-dodge</td>
542 <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>
543 </tr>
544
545 <tr>
546 <td>soft-light</td>
547 <td>Darkens or lightens the colors, dependent on the source
548 color value. If the source color is lighter than 0.5, the destination
549 is lightened. If the source color is darker than 0.5, the destination
550 is darkened, as if it were burned in. The degree of darkening or
551 lightening is proportional to the difference between the source color
552 and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
553 with pure black or white produces a distinctly darker or lighter area,
554 but does not result in pure black or white. </td>
555 </tr>
556
557 <tr>
558 <td>pegtop-light</td>
559 <td>Almost equivalent to 'Soft-Light', but using a
560 continuous mathematical formula rather than two conditionally
561 selected formulae. </td>
562 </tr>
563
564 <tr>
565 <td>vivid-light</td>
566 <td>A modified 'Linear-Light' designed to preserve very strong
567 primary and secondary colors in the image. </td>
568 </tr>
569
570 <tr>
571 <td>pin-light</td>
572 <td>Similar to 'Hard-Light', but using sharp linear shadings,
573 to simulate the effects of a strong 'pinhole' light source. </td>
574 </tr>
575
576 </tbody>
577 </table>
578
579 <p>Also included are these special purpose compose methods:</p>
580
581 <table class="table table-sm table-hover table-striped table-responsive">
582 <tbody>
583 <tr>
584 <th align="left" style="width: 8%">Method</th>
585 <th align="left">Description</th>
586 </tr>
587
588 <tr>
589 <td>copy</td>
590 <td>This is equivalent to the Duff-Porter composition method
591 '<code>Src,</code>' but without clearing the parts of the destination
592 image that is not overlaid. </td>
593 </tr>
594
595 <tr>
596 <td>copy-*</td>
597 <td>Copy the specified channel (Red, Green, Blue, Cyan,
598 Magenta, Yellow, Black, or Opacity) in the source image to the
599 same channel in the destination image. If the channel specified
600 does not exist in the source image, (which can only happen for methods,
601 '<code>copy-opacity</code>' or '<code>copy-black</code>') then it is
602 assumed that the source image is a special grayscale channel image
603 of the values that is to be copied. </td>
604 </tr>
605
606 <tr>
607 <td>change-mask</td>
608 <td>Replace any destination pixel that is the similar to the
609 source images pixel (as defined by the current <a
610 href="../command-line-options/index.html#fuzz">-fuzz</a> factor), with transparency.
611 </td>
612 </tr>
613
614 <tr>
615 <td>stereo</td>
616 <td>create a stereo anaglyph</td>
617 </tr>
618 </tbody>
619 </table>
620
621 <p>On top of these composed methods are a few special ones that not only require
622 the two images that are being merged or overlaid, but have some extra numerical
623 arguments, which are tabled below. </p>
624
625 <p>In the "<code>composite</code>" command these composition methods are
626 selected using special options with the arguments needed. They are usually,
627 but not always, the same name as the composite 'method' they use, and replaces
628 the normal use of the <a href="../command-line-options/index.html#compose" >-compose</a>
629 setting in the "<code>composite</code>" command. For example... </p>
630
631 <pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><code>composite ... -blend 50x50 ... </code></pre>
632
633 <p>The "<samp>$ magick</samp>" command can accept these extra arguments to its <a href="../command-line-options/index.html#composite"
634 >-composite</a> operator, using the special <a href="../command-line-options/index.html#define">-define</a>
635 attribute of <code>compose:args</code>. This means you can now
636 make use of these special augmented <a href="../command-line-options/index.html#compose"
637 >-compose</a> methods, those the argument and the method both need to be set
638 separately. For example... </p>
639
640 <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>
641
642 <p>The following is a table of these special 'argumented' compose methods,
643 with a brief summary of what they do. For more details see the equivalent
644 "composite" command option name. </p>
645
646 <table class="table table-sm table-hover table-striped table-responsive">
647 <tbody>
648 <tr>
649 <th align="left" style="width: 8%">Method</th>
650 <th align="left">Description</th>
651 </tr>
652
653 <tr>
654 <td>dissolve</td>
655 <td>Arguments:
656 <var>src_percent</var>[x<var>dst_percent</var>]
657 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#dissolve">-dissolve</a>.
658 Dissolve the 'source' image by the percentage given before overlaying
659 'over' the 'destination' image. If <var>src_percent</var> is
660 greater than 100, it starts dissolving the main image so it will
661 become transparent at a value of <code>200</code>. If
662 both percentages are given, each image are dissolved to the
663 percentages given.
664 </td>
665 </tr>
666
667 <tr>
668 <td>blend</td>
669 <td>Arguments:
670 <var>src_percent</var>[x<var>dst_percent</var>]
671 <br/>Equivalent to "<code>composite</code>" <a
672 href="../command-line-options/index.html#blend">-blend</a>.
673 Average the images together ('plus') according to the percentages
674 given and each pixels transparency. If only a single percentage value
675 is given it sets the weight of the composite or 'source' image, while
676 the background image is weighted by the exact opposite amount. That is
677 a <code>-blend 30</code> merges 30% of the 'source' image with 70% of
678 the 'destination' image. Thus it is equivalent to <code>-blend
679 30x70</code>.
680 </td>
681 </tr>
682
683 <tr>
684 <td>mathematics</td>
685 <td>Arguments: <var>A, B, C, D</var>
686 <br/>Not available in "<code>composite</code>" at this time.
687 Merge the source and destination images according to the formula
688 <ul><code>A*Sc*Dc + B*Sc + C*Dc + D</code></ul>
689 Can be used to generate a custom composition method that would
690 otherwise need to be implemented using the slow <a
691 href="../command-line-options/index.html#fx">-fx</a> DIY image operator.
692 </td>
693 </tr>
694
695 <tr>
696 <td>modulate</td>
697 <td>Arguments:
698 <var>brightness</var>[x<var>saturation</var>]
699 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#watermark">-watermark</a>.
700 Take a grayscale image (with alpha mask) and modify the destination
701 image's brightness according to watermark image's grayscale value and
702 the <var>brightness</var> percentage. The destinations
703 color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
704 (no color change).
705
706 </td>
707 </tr>
708
709 <tr>
710 <td>displace</td>
711 <td>Arguments:
712 <var>X-scale</var>[x<var>Y-scale</var>][!][%]
713 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#displace">-displace</a>.
714 With this option, the 'overlay' image, and optionally the 'mask'
715 image, is used as a relative displacement map, which is used to
716 displace the lookup of what part of the destination image is seen at
717 each point of the overlaid area. Much like the displacement map is a
718 'lens' that distorts the original 'background' image behind it.
719 <br/><br/>
720 The X-scale is modulated by the 'red' channel of the overlay image
721 while the Y-scale is modulated by the green channel, (the mask image
722 if given is rolled into green channel of the overlay image. This
723 separation allows you to modulate the X and Y lookup displacement
724 separately allowing you to do 2-dimensional displacements, rather
725 than 1-dimensional vectored displacements (using grayscale image).
726 <br/><br/>
727 If the overlay image contains transparency this is used as a mask
728 of the resulting image to remove 'invalid' pixels.
729 <br/><br/>
730 The '%' flag makes the displacement scale relative to the size of the
731 overlay image (100% = half width/height of image). Using '!' switches
732 percentage arguments to refer to the destination image size instead.
733 <br/><br/>
734 </td>
735 </tr>
736
737 <tr>
738 <td>distort</td>
739 <td>Arguments:
740 <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
741 <br/>Not available in "<code>composite</code>" at this time.
742 Exactly as per 'Displace' (above), but using absolute coordinates,
743 relative to the center of the overlay (or that given). Basically
744 allows you to generate absolute distortion maps where 'black' will
745 look up the left/top edge, and 'white' looks up the bottom/right
746 edge of the destination image, according to the scale given.
747 <br/><br/>
748 The '!' flag not only switches percentage scaling, to use the
749 destination image, but also the image the center offset of the lookup.
750 This means the overlay can lookup a completely different region of the
751 destination image.
752 <br/><br/>
753 </td>
754 </tr>
755
756 <tr>
757 <td>blur</td>
758 <td>Arguments:
759 <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
760 <br/>Equivalent to "<code>composite</code>" <a href="../command-line-options/index.html#blur-composite">-blur</a>.
761 A Variable Blur Mapping Composition method, where each pixel in the
762 overlaid region is replaced with an Elliptical Weighted Average (EWA),
763 with an ellipse (typically a circle) of the given sigma size, scaled
764 according to overlay (source image) grayscale mapping.
765 <br/><br/>
766 As per 'Displace' and 'Distort', the red channel will modulate the
767 width of the ellipse, while the green channel will modulate the height
768 of the ellipse. If a single Angle value is given in the arguments,
769 then the ellipse will then be rotated by the angle specified.
770 <br/><br/>
771 Normally the blue channel of the mapping overlay image is ignored.
772 However if a second ellipse angle is given, then it is assumed that
773 the blue channel defines a variable angle for the ellipse ranging from
774 the first angle to the second angle given. This allows to generate
775 radial blurs, or a rough approximation for rotational blur. Or any mix
776 of the two.
777 <br/><br/>
778 </td>
779 </tr>
780 <tr>
781 <td>seamless-blend</td>
782 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
783 <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>
784 </td>
785 </tr>
786 <tr>
787 <td>saliency-blend</td>
788 <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
789 <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>
790 </td>
791 </tr>
792
793
794 </tbody>
795 </table>
796
797 <p>To print a complete list of all the available compose operators, use <a
798 href="../command-line-options/index.html#list">-list compose</a>.</p>
799 </div>
800
801 </div>
802 <div class="col-md-3">
803 <div class="container text-center my-3">
804 <a href="../image/wizard.png" rel="noopener noreferrer" target="_blank">
•805 <img alt="The Tao of the Spiritual Warrior" class="img-fluid img-thumbnail" height="1468" loading="lazy" src="../image/wizard.png" width="1104" />
806 </a>
807 <p class="mt-2"><iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe></p>
808 </div>
809 <div class="container text-center my-3">
•810 <script async="true" src="https://localhost/pagead/js/adsbygoogle.js?client=ca-pub-3129977114552745"
811 crossorigin="anonymous"></script>
812 <!-- Banner Ad -->
813 <ins class="adsbygoogle"
814 style="display:block"
815 data-ad-client="ca-pub-3129977114552745"
816 data-ad-slot="1083537442"
817 data-ad-format="auto"
818 data-full-width-responsive="true"></ins>
819 <script>
820 (adsbygoogle = window.adsbygoogle || []).push({});
821 </script>
822 </div>
823 </div>
824 </div>
825 <a aria-label="About ImageMagick" class="btn btn-outline-warning mt-3" href="../index-2.html">About ImageMagick</a>
826 </main><!-- /.container -->
827 <footer class="text-center pt-5 my-5 text-body-secondary border-top">
828 <div class="container-fluid">
829 <a href="../security-policy/index.html">Security</a> •
830 <a href="../news/index.html">News</a>
•831
832 <a href="#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../image/wand.ico" /></a>
833
834 <a href="../links/index.html">Related</a> •
835 <a href="../sitemap/index.html">Sitemap</a>
•836 <br />
837 <a href="../support/index.html">Sponsor</a> •
838 <a href="../cite/index.html">Cite</a> •
839 <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
840 <a href="https://github.com/ImageMagick/ImageMagick/discussions">Contact Us</a>
•841 <br />
842 <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">
843 <title>GitHub</title>
844 <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" />
845 </svg></a> •
846 <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">
847 <title>Twitter</title>
848 <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" />
849 </svg></a>
•850 <br />
851 <small>Copyright © 1999 ImageMagick Studio LLC</small>
852 </div>
853 </footer>
854 <div style="visibility: hidden;">
855 <div class="gcse-search"></div>
856 </div>
857 </div>
858
859 <!-- Javascript assets -->
860 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
861 </body>
862
863
864 </html>