compose.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <title>ImageMagick – Alpha Compositing</title>
  7. <meta name="application-name" content="ImageMagick" />
  8. <meta name="description" content="" />
  9. <meta name="application-url" content="https://imagemagick.org" />
  10. <meta name="generator" content="PHP" />
  11. <meta name="keywords" content="alpha, compositing, image processing software" />
  12. <meta name="rating" content="GENERAL" />
  13. <meta name="robots" content="INDEX, FOLLOW" />
  14. <meta name="generator" content="ImageMagick Studio LLC" />
  15. <meta name="author" content="ImageMagick Studio LLC" />
  16. <meta name="revisit-after" content="2 DAYS" />
  17. <meta name="resource-type" content="document" />
  18. <meta name="copyright" content="Copyright (c) 1999 ImageMagick Studio LLC" />
  19. <meta name="distribution" content="Global" />
  20. <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
  21. <meta property='og:url' content='../' />
  22. <meta property='og:title' content='ImageMagick' />
  23. <meta property='og:image' content='../images/logo.png' />
  24. <meta property='og:type' content='website' />
  25. <meta property='og:site_name' content='ImageMagick' />
  26. <meta property='og:description' content="Create, Edit, Compose, or Convert Digital Images" />
  27. <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
  28. <link href="compose.html" rel="canonical" />
  29. <link href="../images/wand.png" rel="icon" />
  30. <link href="../images/wand.ico" rel="shortcut icon" />
  31. <link href="assets/magick.css" rel="stylesheet" />
  32. </head>
  33. <body>
  34. <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
  35. <div class="container-fluid">
  36. <a class="navbar-brand" href="../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
  37. <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">
  38. <span class="navbar-toggler-icon"></span>
  39. </button>
  40. <div class="collapse navbar-collapse" id="magick-navbars">
  41. <ul class="navbar-nav me-auto mb-2 mb-md-0">
  42. <li class="nav-item">
  43. <a class="nav-link " href="../www/download.html">Download</a>
  44. </li>
  45. <li class="nav-item">
  46. <a class="nav-link " href="../www/command-line-tools.html">Tools</a>
  47. </li>
  48. <li class="nav-item">
  49. <a class="nav-link " href="../www/command-line-processing.html">CLI</a>
  50. </li>
  51. <li class="nav-item">
  52. <a class="nav-link " href="../www/develop.html">Develop</a>
  53. </li>
  54. <li class="nav-item">
  55. <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
  56. </li>
  57. <li class="nav-item">
  58. <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
  59. </li>
  60. </ul>
  61. <form class="d-flex form-inline" action="search.html">
  62. <input class="form-control me-2" type="text" name="q" placeholder="Search" aria-label="Search">
  63. <button class="btn btn-outline-success" type="submit" name="sa">Search</button>
  64. </form>
  65. </div>
  66. </div>
  67. </nav>
  68. <div class="container">
  69. <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>
  70. <ins class="adsbygoogle"
  71. style="display:block"
  72. data-ad-client="ca-pub-3129977114552745"
  73. data-ad-slot="6345125851"
  74. data-full-width-responsive="true"
  75. data-ad-format="horizontal"></ins>
  76. <script>
  77. (adsbygoogle = window.adsbygoogle || []).push({});
  78. </script>
  79. </div>
  80. <main class="container">
  81. <div class="magick-template">
  82. <div class="magick-header">
  83. <div id="cli-examples"></div>
  84. <p class="lead magick-description">This page descibed the Image composition methods that is used to define how
  85. two images should be merged together in various image operations. For the
  86. Command Line API it is typically set using the <a
  87. href="../www/command-line-options.html#compose" >-compose</a> setting option. </p>
  88. <p>The description of composition uses abstract terminology in order to allow
  89. the description to be more precise, while avoiding constant values which are
  90. specific to a particular build configuration. Each image pixel is represented
  91. by red, green, and blue levels (which are equal for a gray pixel). The
  92. build-dependent value <var>QuantumRange</var> is the maximum integral
  93. value which may be stored, per pixel, in the red, green, or blue channels of
  94. the image. Each image pixel may also optionally (if the image matte channel is
  95. enabled) have an associated level of opacity, ranging from <var>opaque</var> to
  96. <var>transparent</var>, which may be used to determine the influence of the pixel
  97. color when compositing the pixel with another image pixel. If the image matte
  98. channel is disabled, then all pixels in the image are treated as opaque. The
  99. color of an opaque pixel is fully visible while the color of a transparent
  100. pixel color is entirely absent (pixel color is ignored).</p>
  101. <p>By definition, raster images have a rectangular shape. All image rows are of
  102. equal length, as are all image columns. By treating the alpha channel as a
  103. visual "mask" the rectangular image may be given a "shape" by treating the
  104. alpha channel as a cookie-cutter for the image. This is done by setting the
  105. pixels within the shape to be opaque, with pixels outside the shape set as
  106. transparent. Pixels on the boundary of the shape may be between opaque and
  107. transparent in order to provide antialiasing (visually smooth edges). The
  108. description of the composition operators use this concept of image "shape" in
  109. order to make the description of the operators easier to understand. While it
  110. is convenient to describe the operators in terms of "shapes" they are by no
  111. means limited to mask-style operations since they are based on continuous
  112. floating-point mathematics rather than simple boolean operations.</p>
  113. <p>The following alpha blending (Duff-Porter) compose methods are available:</p>
  114. <table class="table table-sm table-hover table-striped table-responsive">
  115. <tbody>
  116. <tr>
  117. <th align="left" style="width: 8%">Method</th>
  118. <th align="left">Description</th>
  119. </tr>
  120. <tr>
  121. <td>clear</td>
  122. <td>Both the color and the alpha of the destination are
  123. cleared. Neither the source nor the destination are used (except for
  124. destinations size and other meta-data which is always preserved.</td>
  125. </tr>
  126. <tr>
  127. <td>src</td>
  128. <td>The source is copied to the destination. The destination
  129. is not used as input, though it is cleared.</td>
  130. </tr>
  131. <tr>
  132. <td>dst</td>
  133. <td>The destination is left untouched. The source image is
  134. completely ignored.</td>
  135. </tr>
  136. <tr>
  137. <td>src-over</td>
  138. <td>The source is composited over the destination. this is
  139. the default alpha blending compose method, when neither the compose
  140. setting is set, nor is set in the image meta-data.</td>
  141. </tr>
  142. <tr>
  143. <td>dst-over</td>
  144. <td>The destination is composited over the source and the
  145. result replaces the destination.</td>
  146. </tr>
  147. <tr>
  148. <td>src-in</td>
  149. <td>The part of the source lying inside of the destination
  150. replaces the destination.</td>
  151. </tr>
  152. <tr>
  153. <td>dst-in</td>
  154. <td>The part of the destination lying inside of the source
  155. replaces the destination. Areas not overlaid are cleared.</td>
  156. </tr>
  157. <tr>
  158. <td>src-out</td>
  159. <td>The part of the source lying outside of the destination
  160. replaces the destination.</td>
  161. </tr>
  162. <tr>
  163. <td>dst-out</td>
  164. <td>The part of the destination lying outside of the source
  165. replaces the destination.</td>
  166. </tr>
  167. <tr>
  168. <td>src-atop</td>
  169. <td>The part of the source lying inside of the destination is
  170. composited onto the destination.</td>
  171. </tr>
  172. <tr>
  173. <td>dst-atop</td>
  174. <td>The part of the destination lying inside of the source is
  175. composited over the source and replaces the destination. Areas not
  176. overlaid are cleared. </td>
  177. </tr>
  178. <tr>
  179. <td>xor</td>
  180. <td>The part of the source that lies outside of the
  181. destination is combined with the part of the destination that lies
  182. outside of the source. Source or Destination, but not both. </td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. <p>Any of the 'Src-*' methods can also be specified without the 'Src-' part.
  187. For example the default compose method can be specified as just 'Over'.</p>
  188. <p>Many of these compose methods will clear the destination image which was
  189. not overlaid by the source image. This is to be expected as part of that
  190. specific composition methods defintion. You can disable this by setting the
  191. special <a href="../www/command-line-options.html#define"
  192. >-define</a> 'compose:outside-overlay' to a value of 'false' will turn off
  193. this behavior. </p>
  194. <p>On top of the above 12 Duff-Porter Alpha Composition methods, one special
  195. related method '<samp>Copy</samp>' has been provided. This is equivalent to
  196. using the '<samp>Src</samp>' with the special <a href="../www/command-line-options.html#define"
  197. >-define</a> option '<samp>compose:outside-overlay</samp>' set to
  198. '<samp>false</samp>', so as to only modify the overlaid area, without clearing
  199. the rest of the image outside the overlaid area. </p>
  200. <p>The following mathematical composition methods are also available. </p>
  201. <table class="table table-sm table-hover table-striped table-responsive">
  202. <tbody>
  203. <tr>
  204. <th align="left" style="width: 8%">Method</th>
  205. <th align="left">Description</th>
  206. </tr>
  207. <tr>
  208. <td>multiply</td>
  209. <td>The source is multiplied by the destination and replaces
  210. the destination. The resultant color is always at least as dark as
  211. either of the two constituent colors. Multiplying any color with black
  212. produces black. Multiplying any color with white leaves the original
  213. color unchanged.</td>
  214. </tr>
  215. <tr>
  216. <td>screen</td>
  217. <td>The source and destination are complemented and then
  218. multiplied and then replace the destination. The resultant color is
  219. always at least as light as either of the two constituent colors.
  220. Screening any color with white produces white. Screening any color
  221. with black leaves the original color unchanged.</td>
  222. </tr>
  223. <tr>
  224. <td>plus</td>
  225. <td>The source is added to the destination and replaces the
  226. destination. This operator is useful for averaging or a controlled
  227. merger of two images, rather than a direct overlay.</td>
  228. </tr>
  229. <tr>
  230. <td>add</td>
  231. <td>As per 'plus' but transparency data is treated as matte
  232. values. As such any transparent areas in either image remain
  233. transparent. </td>
  234. </tr>
  235. <tr>
  236. <td>minus</td>
  237. <td>Subtract the colors in the source image from the
  238. destination image. When transparency is involved, opaque areas is
  239. subtracted from any destination opaque areas. </td>
  240. </tr>
  241. <tr>
  242. <td>subtract</td>
  243. <td>Subtract the colors in the source image from the
  244. destination image. When transparency is involved transparent areas are
  245. subtracted, so only the opaque areas in the source remain opaque in
  246. the destination image. </td>
  247. </tr>
  248. <tr>
  249. <td>difference</td>
  250. <td>Subtracts the darker of the two constituent colors from
  251. the lighter. Painting with white inverts the destination color.
  252. Painting with black produces no change.</td>
  253. </tr>
  254. <tr>
  255. <td>exclusion</td>
  256. <td>Produces an effect similar to that of 'difference', but
  257. appears as lower contrast. Painting with white inverts the
  258. destination color. Painting with black produces no change.</td>
  259. </tr>
  260. <tr>
  261. <td>darken</td>
  262. <td>Selects the darker of the destination and source colors.
  263. The destination is replaced with the source when the source is darker,
  264. otherwise it is left unchanged.</td>
  265. </tr>
  266. <tr>
  267. <td>lighten</td>
  268. <td>Selects the lighter of the destination and source colors.
  269. The destination is replaced with the source when the source is
  270. lighter, otherwise it is left unchanged. </td>
  271. </tr>
  272. <tr>
  273. <td>negate</td>
  274. <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>
  275. </tr>
  276. <tr>
  277. <td>reflect</td>
  278. <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>
  279. </tr>
  280. <tr>
  281. <td>freeze</td>
  282. <td>Another variation of reflect mode (base and blend color inverted, the result inverted again). </td>
  283. </tr>
  284. <tr>
  285. <td>stamp</td>
  286. <td>This mode somehow is similar to average mode. It is helpful when applying relief or bump textures to images. </td>
  287. </tr>
  288. <tr>
  289. <td>interpolate</td>
  290. <td>This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors). </td>
  291. </tr>
  292. </table>
  293. <p>Typically these use the default 'Over' alpha blending when transparencies
  294. are also involved, except for 'Plus' which uses a 'plus' alpha blending. This
  295. means the alpha channel of both images will only be used to ensure that any
  296. visible input remains visible even in parts not overlaid. It also means that
  297. any values are weighted by the alpha channel of the input and output images.
  298. This 'Over' alpha blending is also applied to the lighting composition methods
  299. below. </p>
  300. <p> The math composition is applied on an individual channel basis as defined by the <a href="../www/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
  301. composition effects, becoming involved. </p>
  302. <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="../www/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>
  303. <p>This define is not applied to the lighting composition methods (see below) even though they are closely related to mathematical composition methods.</p>
  304. <p>The following lighting composition methods are also available. </p>
  305. <table class="table table-sm table-hover table-striped table-responsive">
  306. <tbody>
  307. <tr>
  308. <th align="left" style="width: 8%">Method</th>
  309. <th align="left">Description</th>
  310. </tr>
  311. <tr>
  312. <td>linear-dodge</td>
  313. <td>This is equivalent to 'Plus' in that the color channels
  314. are simply added, however it does not 'Plus' the alpha channel, but
  315. uses the normal 'Over' alpha blending, which transparencies are
  316. involved. Produces a sort of additive multiply-like result. </td>
  317. </tr>
  318. <tr>
  319. <td>linear-burn</td>
  320. <td>As 'Linear-Dodge', but also subtract one from the result.
  321. Sort of a additive 'Screen' of the images. </td>
  322. </tr>
  323. <tr>
  324. <td>color-dodge</td>
  325. <td>Brightens the destination color to reflect the source
  326. color. Painting with black produces no change.</td>
  327. </tr>
  328. <tr>
  329. <td>color-burn</td>
  330. <td>Darkens the destination color to reflect the source
  331. color. Painting with white produces no change. </td>
  332. </tr>
  333. <tr>
  334. <td>overlay</td>
  335. <td>Multiplies or screens the colors, dependent on the
  336. destination color. Source colors overlay the destination whilst
  337. preserving its highlights and shadows. The destination color is not
  338. replaced, but is mixed with the source color to reflect the lightness
  339. or darkness of the destination.</td>
  340. </tr>
  341. <tr>
  342. <td>hard-light</td>
  343. <td>Multiplies or screens the colors, dependent on the source
  344. color value. If the source color is lighter than 0.5, the destination
  345. is lightened as if it were screened. If the source color is darker
  346. than 0.5, the destination is darkened, as if it were multiplied. The
  347. degree of lightening or darkening is proportional to the difference
  348. between the source color and 0.5. If it is equal to 0.5 the
  349. destination is unchanged. Painting with pure black or white produces
  350. black or white.</td>
  351. </tr>
  352. <tr>
  353. <td>linear-light</td>
  354. <td>Like 'Hard-Light' but using linear-dodge and linear-burn
  355. instead. Increases contrast slightly with an impact on the
  356. foreground's tonal values.</td>
  357. </tr>
  358. <tr>
  359. <td>soft-burn</td>
  360. <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>
  361. </tr>
  362. <tr>
  363. <td>soft-dodge</td>
  364. <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>
  365. </tr>
  366. <tr>
  367. <td>soft-light</td>
  368. <td>Darkens or lightens the colors, dependent on the source
  369. color value. If the source color is lighter than 0.5, the destination
  370. is lightened. If the source color is darker than 0.5, the destination
  371. is darkened, as if it were burned in. The degree of darkening or
  372. lightening is proportional to the difference between the source color
  373. and 0.5. If it is equal to 0.5, the destination is unchanged. Painting
  374. with pure black or white produces a distinctly darker or lighter area,
  375. but does not result in pure black or white. </td>
  376. </tr>
  377. <tr>
  378. <td>pegtop-light</td>
  379. <td>Almost equivalent to 'Soft-Light', but using a
  380. continuous mathematical formula rather than two conditionally
  381. selected formulae. </td>
  382. </tr>
  383. <tr>
  384. <td>vivid-light</td>
  385. <td>A modified 'Linear-Light' designed to preserve very stong
  386. primary and secondary colors in the image. </td>
  387. </tr>
  388. <tr>
  389. <td>pin-light</td>
  390. <td>Similar to 'Hard-Light', but using sharp linear shadings,
  391. to simulate the effects of a strong 'pinhole' light source. </td>
  392. </tr>
  393. </tbody>
  394. </table>
  395. <p>Also included are these special purpose compose methods:</p>
  396. <table class="table table-sm table-hover table-striped table-responsive">
  397. <tbody>
  398. <tr>
  399. <th align="left" style="width: 8%">Method</th>
  400. <th align="left">Description</th>
  401. </tr>
  402. <tr>
  403. <td>copy</td>
  404. <td>This is equivalent to the Duff-Porter composition method
  405. '<samp>Src,</samp>' but without clearing the parts of the destination
  406. image that is not overlaid. </td>
  407. </tr>
  408. <tr>
  409. <td>copy-*</td>
  410. <td>Copy the specified channel (Red, Green, Blue, Cyan,
  411. Magenta, Yellow, Black, or Opacity) in the source image to the
  412. same channel in the destination image. If the channel specified
  413. does not exist in the source image, (which can only happen for methods,
  414. '<samp>copy-opacity</samp>' or '<samp>copy-black</samp>') then it is
  415. assumed that the source image is a special grayscale channel image
  416. of the values that is to be copied. </td>
  417. </tr>
  418. <tr>
  419. <td>change-mask</td>
  420. <td>Replace any destination pixel that is the similar to the
  421. source images pixel (as defined by the current <a
  422. href="../www/command-line-options.html#fuzz">-fuzz</a> factor), with transparency.
  423. </td>
  424. </tr>
  425. <tr>
  426. <td>stereo</td>
  427. <td>create a stereo anaglyph</td>
  428. </tr>
  429. </tbody>
  430. </table>
  431. <p>On top of these composed methods are a few special ones that not only require
  432. the two images that are being merged or overlaid, but have some extra numerical
  433. arguments, which are tabled below. </p>
  434. <p>In the "<samp>composite</samp>" command these composition methods are
  435. selected using special options with the arguments needed. They are usually,
  436. but not always, the same name as the composite 'method' they use, and replaces
  437. the normal use of the <a href="../www/command-line-options.html#compose" >-compose</a>
  438. setting in the "<samp>composite</samp>" command. For example... </p>
  439. <pre class="bg-light text-dark mx-4"><samp>composite ... -blend 50x50 ... </samp></pre>
  440. <p>The "<samp>magick</samp>" command can accept these extra arguments to its <a href="../www/command-line-options.html#composite"
  441. >-composite</a> operator, using the special <a href="../www/command-line-options.html#define">-define</a>
  442. attribute of <samp>compose:args</samp>. This means you can now
  443. make use of these special augmented <a href="../www/command-line-options.html#compose"
  444. >-compose</a> methods, those the argument and the method both need to be set
  445. separately. For example... </p>
  446. <pre class="bg-light text-dark mx-4 cli"><samp>magick ... -compose blend -define compose:args=50,50 -composite ... </samp></pre>
  447. <p>The following is a table of these special 'argumented' compose methods,
  448. with a brief summary of what they do. For more details see the equivalent
  449. "composite" command option name. </p>
  450. <table class="table table-sm table-hover table-striped table-responsive">
  451. <tbody>
  452. <tr>
  453. <th align="left" style="width: 8%">Method</th>
  454. <th align="left">Description</th>
  455. </tr>
  456. <tr>
  457. <td>dissolve</td>
  458. <td>Arguments:
  459. <var>src_percent</var>[x<var>dst_percent</var>]
  460. <br/>Equivalent to "<samp>composite</samp>" <a href="../www/command-line-options.html#dissolve">-dissolve</a>.
  461. Dissolve the 'source' image by the percentage given before overlaying
  462. 'over' the 'destination' image. If <var>src_percent</var> is
  463. greater than 100, it starts dissolving the main image so it will
  464. become transparent at a value of <samp>200</samp>. If
  465. both percentages are given, each image are dissolved to the
  466. percentages given.
  467. </td>
  468. </tr>
  469. <tr>
  470. <td>blend</td>
  471. <td>Arguments:
  472. <var>src_percent</var>[x<var>dst_percent</var>]
  473. <br/>Equivalent to "<samp>composite</samp>" <a
  474. href="../www/command-line-options.html#blend">-blend</a>.
  475. Average the images together ('plus') according to the percentages
  476. given and each pixels transparency. If only a single percentage value
  477. is given it sets the weight of the composite or 'source' image, while
  478. the background image is weighted by the exact opposite amount. That is
  479. a <samp>-blend 30</samp> merges 30% of the 'source' image with 70% of
  480. the 'destination' image. Thus it is equivalent to <samp>-blend
  481. 30x70</samp>.
  482. </td>
  483. </tr>
  484. <tr>
  485. <td>mathematics</td>
  486. <td>Arguments: <var>A, B, C, D</var>
  487. <br/>Not available in "<samp>composite</samp>" at this time.
  488. Merge the source and destination images according to the formula
  489. <ul><samp>A*Sc*Dc + B*Sc + C*Dc + D</samp></ul>
  490. Can be used to generate a custom composition method that would
  491. otherwise need to be implemented using the slow <a
  492. href="../www/command-line-options.html#fx">-fx</a> DIY image operator.
  493. </td>
  494. </tr>
  495. <tr>
  496. <td>modulate</td>
  497. <td>Arguments:
  498. <var>brightness</var>[x<var>saturation</var>]
  499. <br/>Equivalent to "<samp>composite</samp>" <a href="../www/command-line-options.html#watermark">-watermark</a>.
  500. Take a grayscale image (with alpha mask) and modify the destination
  501. image's brightness according to watermark image's grayscale value and
  502. the <var>brightness</var> percentage. The destinations
  503. color saturation attribute is just direct modified by the <var>saturation</var> percentage, which defaults to 100 percent
  504. (no color change).
  505. </td>
  506. </tr>
  507. <tr>
  508. <td>displace</td>
  509. <td>Arguments:
  510. <var>X-scale</var>[x<var>Y-scale</var>][!][%]
  511. <br/>Equivalent to "<samp>composite</samp>" <a href="../www/command-line-options.html#displace">-displace</a>.
  512. With this option, the 'overlay' image, and optionally the 'mask'
  513. image, is used as a relative displacement map, which is used to
  514. displace the lookup of what part of the destination image is seen at
  515. each point of the overlaid area. Much like the displacement map is a
  516. 'lens' that distorts the original 'background' image behind it.
  517. <br/><br/>
  518. The X-scale is modulated by the 'red' channel of the overlay image
  519. while the Y-scale is modulated by the green channel, (the mask image
  520. if given is rolled into green channel of the overlay image. This
  521. separation allows you to modulate the X and Y lookup displacement
  522. separately allowing you to do 2-dimensional displacements, rather
  523. than 1-dimensional vectored displacements (using grayscale image).
  524. <br/><br/>
  525. If the overlay image contains transparency this is used as a mask
  526. of the resulting image to remove 'invalid' pixels.
  527. <br/><br/>
  528. The '%' flag makes the displacement scale relative to the size of the
  529. overlay image (100% = half width/height of image). Using '!' switches
  530. percentage arguments to refer to the destination image size instead.
  531. <br/><br/>
  532. </td>
  533. </tr>
  534. <tr>
  535. <td>distort</td>
  536. <td>Arguments:
  537. <var>X-scale</var>[x<var>Y-scale</var>[+<var>X-center</var>+<var>Y-center</var>]][!][%]
  538. <br/>Not available in "<samp>composite</samp>" at this time.
  539. Exactly as per 'Displace' (above), but using absolute coordinates,
  540. relative to the center of the overlay (or that given). Basically
  541. allows you to generate absolute distortion maps where 'black' will
  542. look up the left/top edge, and 'white' looks up the bottom/right
  543. edge of the destination image, according to the scale given.
  544. <br/><br/>
  545. The '!' flag not only switches percentage scaling, to use the
  546. destination image, but also the image the center offset of the lookup.
  547. This means the overlay can lookup a completely different region of the
  548. destination image.
  549. <br/><br/>
  550. </td>
  551. </tr>
  552. <tr>
  553. <td>blur</td>
  554. <td>Arguments:
  555. <var>Width</var>[x<var>Height</var>[+<var>Angle</var>][+<var>Angle2</var>]]
  556. <br/>Equivalent to "<samp>composite</samp>" <a href="../www/command-line-options.html#blur-composite">-blur</a>.
  557. A Variable Blur Mapping Composition method, where each pixel in the
  558. overlaid region is replaced with an Elliptical Weighted Average (EWA),
  559. with an ellipse (typically a circle) of the given sigma size, scaled
  560. according to overlay (source image) grayscale mapping.
  561. <br/><br/>
  562. As per 'Displace' and 'Distort', the red channel will modulate the
  563. width of the ellipse, while the green channel will modulate the height
  564. of the ellipse. If a single Angle value is given in the arguments,
  565. then the ellipse will then be rotated by the angle specified.
  566. <br/><br/>
  567. Normally the blue channel of the mapping overlay image is ignored.
  568. However if a second ellipse angle is given, then it is assumed that
  569. the blue channel defines a variable angle for the ellipse ranging from
  570. the first angle to the second angle given. This allows to generate
  571. radial blurs, or a rough approximation for rotational blur. Or any mix
  572. of the two.
  573. <br/><br/>
  574. </td>
  575. </tr>
  576. <tr>
  577. <td>seamless-blend</td>
  578. <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
  579. <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>
  580. </td>
  581. </tr>
  582. <tr>
  583. <td>saliency-blend</td>
  584. <td>Arguments: <var>max-iterations</var>x<var>distortion</var>
  585. <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>
  586. </td>
  587. </tr>
  588. </tbody>
  589. </table>
  590. <p>To print a complete list of all the available compose operators, use <a
  591. href="../www/command-line-options.html#list">-list compose</a>.</p>
  592. </div> </div>
  593. </main><!-- /.container -->
  594. <footer class="magick-footer">
  595. <div class="container-fluid">
  596. <a href="../www/security-policy.html">Security</a> •
  597. <a href="../www/news.html">News</a>
  598. <a href="compose.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
  599. <a href="../www/links.html">Related</a> •
  600. <a href="../www/sitemap.html">Sitemap</a>
  601. <br/>
  602. <a href="../www/support.html">Sponsor</a> •
  603. <a href="../www/cite.html">Cite</a> •
  604. <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
  605. <a href="../www/https://imagemagick.org/script/contact.php">Contact Us</a>
  606. <br/>
  607. <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> •
  608. <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 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>
  609. <br/>
  610. <small>Copyright © 1999 ImageMagick Studio LLC</small>
  611. </div>
  612. </footer>
  613. <!-- Javascript assets -->
  614. <script src="assets/magick.js" ></script>
  615. </body>
  616. </html>