magick-vector-graphics.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  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 – Magick Vector Graphics</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="magick, vector, graphics, 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="../www/magick-vector-graphics.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="../index.html"><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="download.html">Download</a>
  44. </li>
  45. <li class="nav-item">
  46. <a class="nav-link " href="command-line-tools.html">Tools</a>
  47. </li>
  48. <li class="nav-item">
  49. <a class="nav-link " href="command-line-processing.html">CLI</a>
  50. </li>
  51. <li class="nav-item">
  52. <a class="nav-link " href="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="../www/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="http://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. <h1 class="text-center">Magick Vector Graphics</h1>
  84. <p class="text-center"><a href="magick-vector-graphics.html#overview">MVG Overview</a> • <a href="magick-vector-graphics.html#primitives">Drawing Primitives</a></p>
  85. <p class="lead magick-description">This specification defines the features and syntax for Magick Vector Graphics (MVG), a modularized language for describing two-dimensional vector and mixed vector/raster graphics in ImageMagick. You can use the language to draw from the
  86. command line, from an MVG file, from an <a href="http://www.w3.org/TR/SVG/">SVG -- Scalable Vector Graphics</a> file or from one of the ImageMagick <a href="develop.html">program interfaces</a>. Use this command, for example, to render an arc:</p>
  87. <pre class="bg-light text-dark mx-4 cli"><samp>magick -size 100x60 canvas:skyblue -fill white -stroke black \
  88. -draw "path 'M 30,40 A 30,20 20 0,0 70,20 A 30,20 20 1,0 30,40 Z '" \
  89. arc.png
  90. </samp></pre>
  91. <p>and here is the result:</p>
  92. <ul>
  93. <a href="../images/arc.png"><img src="../images/arc.png" width="100" height="60" alt="arc" /></a>
  94. </ul>
  95. <p>When the drawing gets sufficiently complex, we recommend you assemble the graphic primitives into a MVG file. For our example, we use <a href="https://imagemagick.org/source/piechart.mvg">piechart.mvg</a>:</p>
  96. <pre class="pre-scrollable bg-light text-dark mx-4"><samp>push graphic-context
  97. viewbox 0 0 624 369
  98. affine 0.283636 0 0 0.283846 -0 -0
  99. push graphic-context
  100. push graphic-context
  101. fill 'darkslateblue'
  102. stroke 'blue'
  103. stroke-width 1
  104. rectangle 1,1 2199,1299
  105. pop graphic-context
  106. push graphic-context
  107. font-size 40
  108. fill 'white'
  109. stroke-width 1
  110. text 600,1100 'Average: 20.0'
  111. pop graphic-context
  112. push graphic-context
  113. fill 'red'
  114. stroke 'black'
  115. stroke-width 5
  116. path 'M700.0,600.0 L340.0,600.0 A360.0,360.0 0 0,1 408.1452123287954,389.2376150414973 z'
  117. pop graphic-context
  118. push graphic-context
  119. font-size 40
  120. fill 'white'
  121. stroke-width 1
  122. text 1400,140 'MagickWand for PHP'
  123. pop graphic-context
  124. push graphic-context
  125. font-size 30
  126. fill 'white'
  127. stroke-width 1
  128. text 1800,140 '(10.0%)'
  129. pop graphic-context
  130. push graphic-context
  131. fill 'red'
  132. stroke 'black'
  133. stroke-width 4
  134. rectangle 1330,100 1370,140
  135. pop graphic-context
  136. push graphic-context
  137. fill 'yellow'
  138. stroke 'black'
  139. stroke-width 5
  140. path 'M700.0,600.0 L408.1452123287954,389.2376150414973 A360.0,360.0 0 0,1 976.5894480359858,369.56936567559273 z'
  141. pop graphic-context
  142. push graphic-context
  143. font-size 40
  144. fill 'white'
  145. stroke-width 1
  146. text 1400,220 'MagickCore'
  147. pop graphic-context
  148. push graphic-context
  149. font-size 30
  150. fill 'white'
  151. stroke-width 1
  152. text 1800,220 '(29.0%)'
  153. pop graphic-context
  154. push graphic-context
  155. fill 'yellow'
  156. stroke 'black'
  157. stroke-width 4
  158. rectangle 1330,180 1370,220
  159. pop graphic-context
  160. push graphic-context
  161. fill 'fuchsia'
  162. stroke 'black'
  163. stroke-width 5
  164. path 'M700.0,600.0 L976.5894480359858,369.56936567559273 A360.0,360.0 0 0,1 964.2680466142854,844.4634932636567 z'
  165. pop graphic-context
  166. push graphic-context
  167. font-size 40
  168. fill 'white'
  169. stroke-width 1
  170. text 1400,300 'MagickWand'
  171. pop graphic-context
  172. push graphic-context
  173. font-size 30
  174. fill 'white'
  175. stroke-width 1
  176. text 1800,300 '(22.9%)'
  177. pop graphic-context
  178. push graphic-context
  179. fill 'fuchsia'
  180. stroke 'black'
  181. stroke-width 4
  182. rectangle 1330,260 1370,300
  183. pop graphic-context
  184. push graphic-context
  185. fill 'blue'
  186. stroke 'black'
  187. stroke-width 5
  188. path 'M700.0,600.0 L964.2680466142854,844.4634932636567 A360.0,360.0 0 0,1 757.853099990584,955.3210081341651 z'
  189. pop graphic-context
  190. push graphic-context
  191. font-size 40
  192. fill 'white'
  193. stroke-width 1
  194. text 1400,380 'JMagick'
  195. pop graphic-context
  196. push graphic-context
  197. font-size 30
  198. fill 'white'
  199. stroke-width 1
  200. text 1800,380 '(10.6%)'
  201. pop graphic-context
  202. push graphic-context
  203. fill 'blue'
  204. stroke 'black'
  205. stroke-width 4
  206. rectangle 1330,340 1370,380
  207. pop graphic-context
  208. push graphic-context
  209. fill 'lime'
  210. stroke 'black'
  211. stroke-width 5
  212. path 'M700.0,600.0 L757.853099990584,955.3210081341651 A360.0,360.0 0 0,1 340.0,600.0 z'
  213. pop graphic-context
  214. push graphic-context
  215. font-size 40
  216. fill 'white'
  217. stroke-width 1
  218. text 1400,460 'Magick++'
  219. pop graphic-context
  220. push graphic-context
  221. font-size 30
  222. fill 'white'
  223. stroke-width 1
  224. text 1800,460 '(27.5%)'
  225. pop graphic-context
  226. push graphic-context
  227. fill 'lime'
  228. stroke 'black'
  229. stroke-width 4
  230. rectangle 1330,420 1370,460
  231. pop graphic-context
  232. push graphic-context
  233. font-size 100
  234. fill 'white'
  235. stroke-width 1
  236. text 100,150 'ImageMagick'
  237. pop graphic-context
  238. push graphic-context
  239. fill 'none'
  240. stroke 'black'
  241. stroke-width 5
  242. circle 700,600 700,960
  243. pop graphic-context
  244. pop graphic-context
  245. pop graphic-context
  246. </samp></pre>
  247. <p>to render a pie chart with this command:</p>
  248. <pre class="bg-light text-dark mx-4 cli"><samp>magick mvg:piechart.mvg piechart.png
  249. </samp></pre>
  250. <p>which produces this rendering:</p>
  251. <ul>
  252. <a href="../images/piechart.png"><img src="../images/piechart.png" width="624" height="369" alt="piechart" /></a>
  253. </ul>
  254. <p>However, in general, MVG is sufficiently difficult to work with that you probably want to use a program to generate your graphics in the SVG format. ImageMagick automagically converts SVG to MVG and renders your image, for example, we render <a href="https://imagemagick.org/source/piechart.svg">piechart.svg</a> with this command:</p>
  255. <pre class="bg-light text-dark mx-4 cli"><samp>magick mvg:piechart.svg piechart.jpg
  256. </samp></pre>
  257. <p>to produce the same pie chart we created with the MVG language.</p>
  258. <p>Drawing is available from many of the ImageMagick <a href="develop.html">program interfaces</a> as well. ImageMagick converts the drawing API calls to MVG and renders it. Here is example code written in the <a href="../www/magick-wand.html">MagickWand</a> language: </p>
  259. <pre class="pre-scrollable bg-light text-dark mx-4"><samp>(void) PushDrawingWand(draw_wand);
  260. {
  261. const PointInfo points[6] =
  262. {
  263. { 180,504 },
  264. { 282.7,578.6 },
  265. { 243.5,699.4 },
  266. { 116.5,699.4 },
  267. { 77.26,578.6 },
  268. { 180,504 }
  269. };
  270. DrawSetStrokeAntialias(draw_wand,True);
  271. DrawSetStrokeWidth(draw_wand,9);
  272. DrawSetStrokeLineCap(draw_wand,RoundCap);
  273. DrawSetStrokeLineJoin(draw_wand,RoundJoin);
  274. (void) DrawSetStrokeDashArray(draw_wand,0,(const double *)NULL);
  275. (void) PixelSetColor(color,"#4000c2");
  276. DrawSetStrokeColor(draw_wand,color);
  277. DrawSetFillRule(draw_wand,EvenOddRule);
  278. (void) PixelSetColor(color,"#800000");
  279. DrawSetFillColor(draw_wand,color);
  280. DrawPolygon(draw_wand,6,points);
  281. }
  282. (void) PopDrawingWand(draw_wand);
  283. </samp></pre>
  284. <h2><a class="anchor" id="overview"></a>MVG Overview</h2>
  285. <p>MVG ignores all white-space between commands. This allows multiple MVG commands per line. It is common convention to terminate each MVG command with a newline to make MVG easier to edit and read. This syntax description uses indentation in MVG sequences to aid with understanding. Indentation is supported but is not required.</p>
  286. <p>Metafile wrapper syntax (to support stand-alone MVG files):</p>
  287. <pre class="bg-light text-dark mx-4"><samp>push graphic-context
  288. viewbox 0 0 width height
  289. [ any other MVG commands ]
  290. pop graphic-context
  291. </samp></pre>
  292. <p>Pattern syntax (saving and restoring context):</p>
  293. <pre class="bg-light text-dark mx-4"><samp>push pattern id x,y width,height
  294. push graphic-context
  295. [ drawing commands ]
  296. pop graphic-context
  297. pop pattern
  298. </samp></pre>
  299. <p>an example is (%s is a identifier string):</p>
  300. <pre class="bg-light text-dark mx-4"><samp>push defs
  301. push pattern %s 10,10 20,20
  302. push graphic-context
  303. fill red
  304. rectangle 5,5 15,15
  305. pop graphic-context
  306. push graphic-context
  307. fill green
  308. rectangle 10,10 20,20
  309. pop graphic-context
  310. pop pattern
  311. pop defs
  312. </samp></pre>
  313. <p>For image tiling use:</p>
  314. <pre class="bg-light text-dark mx-4"><samp>push pattern id x,y width,height
  315. image Copy ...
  316. pop pattern
  317. </samp></pre>
  318. <p>Note you can use the pattern for either the fill or stroke like:</p>
  319. <pre class="bg-light text-dark mx-4"><samp>stroke url(#%s)
  320. </samp></pre>
  321. <p>or</p>
  322. <pre class="bg-light text-dark mx-4"><samp>fill url(#%s)
  323. </samp></pre>
  324. <p>The clip path defines a clipping area, where only the contained area to be drawn upon. Areas outside of the clipping areare masked.</p>
  325. <pre class="bg-light text-dark mx-4"><samp>push defs
  326. push clip-path "myClipPath"
  327. push graphic-context
  328. rectangle 10,10 20,20
  329. pop graphic-context
  330. pop clip-path
  331. pop defs
  332. clip-path url(#myClipPath)
  333. </samp></pre>
  334. <h2><a class="anchor" id="primitives"></a>Drawing Primitives</h2>
  335. <p>Here is a complete description of the MVG drawing primitives:</p>
  336. <div>
  337. <table class="table table-sm table-hover table-striped table-responsive">
  338. <thead>
  339. <tr>
  340. <th>Primitive</th>
  341. <th>Description</th>
  342. </tr>
  343. </thead>
  344. <tbody>
  345. <tr>
  346. <td><a class="anchor" id="affine"></a>affine <var>s<sub>x</sub></var>,<var>r<sub>x</sub></var>,<var>r<sub>y</sub></var>,<var>s<sub>y</sub></var>,<var>t<sub>x</sub></var>,<var>t<sub>y</sub></var></td>
  347. <td></td>
  348. </tr>
  349. <tr>
  350. <td><a class="anchor" id="arc"></a>arc <var>x<sub>0</sub></var>,<var>y<sub>0</sub></var> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var> <var>a<sub>0</sub></var>,<var>a<sub>1</sub></var></td>
  351. <td></td>
  352. </tr>
  353. <tr>
  354. <td><a class="anchor" id="bezier"></a>bezier <var>x<sub>0</sub></var>,<var>y<sub>0</sub></var> ... <var>x<sub>n</sub></var>,<var>y<sub>n</sub></var></td>
  355. <td><samp>Bezier</samp> (spline) requires three or more x,y coordinates to define its shape. The first and last points are the knots (preserved coordinates) and any intermediate coordinates are the control points. If two control points are specified, the line between each end knot and its sequentially respective control point determines the tangent direction of the curve at that end. If one control point is specified, the lines from the end knots to the one control point determines the tangent directions of the curve at each end. If more than two control points are specified, then the additional control points act in combination to determine the intermediate shape of the curve. In order to draw complex curves, it is highly recommended either to use the <samp>Path</samp> primitive or to draw multiple four-point bezier segments with the start and end knots of each successive segment repeated. </td>
  356. </tr>
  357. <tr>
  358. <td><a class="anchor" id="border-color"></a>border-color <var>color</var></td>
  359. <td></td>
  360. </tr>
  361. <tr>
  362. <td><a class="anchor" id="circle"></a>circle <var>origin<sub>x</sub></var>,<var>origin<sub>y</sub></var> <var>perimeter<sub>x</sub></var>,<var>perimeter<sub>y</sub></var></td>
  363. <td></td>
  364. </tr>
  365. <tr>
  366. <td><a class="anchor" id="clip-path"></a>clip-path url(<var>name</var>)</td>
  367. <td></td>
  368. </tr>
  369. <tr>
  370. <td><a class="anchor" id="clip-rule"></a>clip-rule <var>rule</var></td>
  371. <td>Choose from these rule types:
  372. <pre class="bg-light text-dark mx-4"><samp>evenodd
  373. nonzero</samp></pre></td>
  374. </tr>
  375. <tr>
  376. <td><a class="anchor" id="clip-units"></a>clip-units <var>units</var></td>
  377. <td>Choose from these unit types:
  378. <pre class="bg-light text-dark mx-4"><samp>userSpace
  379. userSpaceOnUse
  380. objectBoundingBox</samp></pre></td>
  381. </tr>
  382. <tr>
  383. <td><a class="anchor" id="color"></a>color <var>x</var>,<var>y</var> <var>method</var></td>
  384. <td>Choose from these method types:
  385. <pre class="bg-light text-dark mx-4"><samp>point
  386. replace
  387. floodfill
  388. filltoborder
  389. reset</samp></pre></td>
  390. </tr>
  391. <tr>
  392. <td><a class="anchor" id="compliance"></a>compliance <var>type</var></td>
  393. <td>Choose from these compliance types: MVG or SVG</td>
  394. </tr>
  395. <tr>
  396. <td><a class="anchor" id="decorate"></a>decorate <var>type</var></td>
  397. <td>Choose from these types of decorations:
  398. <pre class="bg-light text-dark mx-4"><samp>none
  399. line-through
  400. overline
  401. underline</samp></pre></td>
  402. </tr>
  403. <tr>
  404. <td><a class="anchor" id="ellipse"></a>ellipse <var>center<sub>x</sub></var>,<var>center<sub>y</sub></var> <var>radius<sub>x</sub></var>,<var>radius<sub>y</sub></var> <var>arc<sub>start</sub></var>,<var>arc<sub>stop</sub></var></td>
  405. <td></td>
  406. </tr>
  407. <tr>
  408. <td><a class="anchor" id="fill"></a>fill <var>color</var></td>
  409. <td>Choose from any of these <a href="../www/color.html">colors</a>.</td>
  410. </tr>
  411. <tr>
  412. <td><a class="anchor" id="fill-opacity"></a>fill-opacity <var>opacity</var></td>
  413. <td>The opacity ranges from 0.0 (fully transparent) to 1.0 (fully opaque) or as a percentage (e.g. 50%).</td>
  414. </tr>
  415. <tr>
  416. <td><a class="anchor" id="fill-rule"></a>fill-rule <var>rule</var></td>
  417. <td>Choose from these rule types:
  418. <pre class="bg-light text-dark mx-4"><samp>evenodd
  419. nonzero</samp></pre></td>
  420. </tr>
  421. <tr>
  422. <td><a class="anchor" id="font"></a>font <var>name</var></td>
  423. <td></td>
  424. </tr>
  425. <tr>
  426. <td><a class="anchor" id="font-family"></a>font-family <var>family</var></td>
  427. <td></td>
  428. </tr>
  429. <tr>
  430. <td><a class="anchor" id="font-size"></a>font-size <var>point-size</var></td>
  431. <td></td>
  432. </tr>
  433. <tr>
  434. <td><a class="anchor" id="font-stretch"></a>font-stretch <var>type</var></td>
  435. <td>Choose from these stretch types:
  436. <pre class="bg-light text-dark mx-4"><samp>all
  437. normal
  438. ultra-condensed
  439. extra-condensed
  440. condensed
  441. semi-condensed
  442. semi-expanded
  443. expanded
  444. extra-expanded
  445. ultra-expanded</samp></pre></td>
  446. </tr>
  447. <tr>
  448. <td><a class="anchor" id="font-style"></a>font-style <var>style</var></td>
  449. <td>Choose from these styles:
  450. <pre class="bg-light text-dark mx-4"><samp>all
  451. normal
  452. italic
  453. oblique</samp></pre></td>
  454. </tr>
  455. <tr>
  456. <td><a class="anchor" id="font-weight"></a>font-weight <var>weight</var></td>
  457. <td>Choose from these weights:
  458. <pre class="bg-light text-dark mx-4"><samp>all
  459. normal
  460. bold
  461. 100
  462. 200
  463. 300
  464. 400
  465. 500
  466. 600
  467. 700
  468. 800
  469. 900</samp></pre></td>
  470. </tr>
  471. <tr>
  472. <td><a class="anchor" id="gradient-units"></a>gradient-units <var>units</var></td>
  473. <td>Choose from these units:
  474. <pre class="bg-light text-dark mx-4"><samp>userSpace
  475. userSpaceOnUse
  476. objectBoundingBox</samp></pre></td>
  477. </tr>
  478. <tr>
  479. <td><a class="anchor" id="gravity"></a>gravity <var>type</var></td>
  480. <td>Choose from these gravity types:
  481. <pre class="bg-light text-dark mx-4"><samp>NorthWest
  482. North
  483. NorthEast
  484. West
  485. Center
  486. East
  487. SouthWest
  488. South
  489. SouthEast</samp></pre></td>
  490. </tr>
  491. <tr>
  492. <td><a class="anchor" id="compose"></a>image <var>compose x,y width,height 'filename'</var></td>
  493. <td>Choose from these compose operations:
  494. <table id="table" cellpadding="2" cellspacing="0" style="width: 93%">
  495. <tbody>
  496. <tr>
  497. <th align="left" style="width: 8%">Method</th>
  498. <th align="left">Description</th>
  499. </tr>
  500. <tr>
  501. <td>clear</td>
  502. <td>Both the color and the alpha of the destination are cleared. Neither the source nor the destination are used as input.</td>
  503. </tr>
  504. <tr>
  505. <td>src</td>
  506. <td>The source is copied to the destination. The destination is not used as input.</td>
  507. </tr>
  508. <tr>
  509. <td>dst</td>
  510. <td>The destination is left untouched.</td>
  511. </tr>
  512. <tr>
  513. <td><b>src-over</b></td>
  514. <td>The source is composited over the destination.</td>
  515. </tr>
  516. <tr>
  517. <td>dst-over</td>
  518. <td>The destination is composited over the source and the result replaces the destination.</td>
  519. </tr>
  520. <tr>
  521. <td>src-in</td>
  522. <td>The part of the source lying inside of the destination replaces the destination.</td>
  523. </tr>
  524. <tr>
  525. <td>dst-in</td>
  526. <td>The part of the destination lying inside of the source replaces the destination.</td>
  527. </tr>
  528. <tr>
  529. <td>src-out</td>
  530. <td>The part of the source lying outside of the destination replaces the destination.</td>
  531. </tr>
  532. <tr>
  533. <td>dst-out</td>
  534. <td>The part of the destination lying outside of the source replaces the destination.</td>
  535. </tr>
  536. <tr>
  537. <td>src-atop</td>
  538. <td>The part of the source lying inside of the destination is composited onto the destination.</td>
  539. </tr>
  540. <tr>
  541. <td>dst-atop</td>
  542. <td>The part of the destination lying inside of the source is composited over the source and replaces the destination.</td>
  543. </tr>
  544. <tr>
  545. <td>multiply</td>
  546. <td>The source is multiplied by the destination and replaces the destination. The resultant color is always at least as dark as either of the two constituent colors. Multiplying any color with black produces black. Multiplying any color with white leaves the original color unchanged.</td>
  547. </tr>
  548. <tr>
  549. <td>screen</td>
  550. <td>The source and destination are complemented and then multiplied and then replace the destination. The resultant color is always at least as light as either of the two constituent colors. Screening any color with white produces white. Screening any color with black leaves the original color unchanged.</td>
  551. </tr>
  552. <tr>
  553. <td>overlay</td>
  554. <td>Multiplies or screens the colors, dependent on the destination color. Source colors overlay the destination whilst preserving its highlights and shadows. The destination color is not replaced, but is mixed with the source color to reflect the lightness or darkness of the destination.</td>
  555. </tr>
  556. <tr>
  557. <td>darken</td>
  558. <td>Selects the darker of the destination and source colors. The destination is replaced with the source when the source is darker, otherwise it is left unchanged.</td>
  559. </tr>
  560. <tr>
  561. <td>lighten</td>
  562. <td>Selects the lighter of the destination and source colors. The destination is replaced with the source when the source is lighter, otherwise it is left unchanged.</td>
  563. </tr>
  564. <tr>
  565. <td>linear-light</td>
  566. <td>Increase contrast slightly with an impact on the foreground's tonal values.</td>
  567. </tr>
  568. <tr>
  569. <td>color-dodge</td>
  570. <td>Brightens the destination color to reflect the source color. Painting with black produces no change.</td>
  571. </tr>
  572. <tr>
  573. <td>color-burn</td>
  574. <td>Darkens the destination color to reflect the source color. Painting with white produces no change.</td>
  575. </tr>
  576. <tr>
  577. <td>hard-light</td>
  578. <td>Multiplies or screens the colors, dependent on the source color value. If the source color is lighter than 0.5, the destination is lightened as if it were screened. If the source color is darker than 0.5, the destination is darkened, as if it were multiplied. The degree of lightening or darkening is proportional to the difference between the source color and 0.5. If it is equal to 0.5 the destination is unchanged. Painting with pure black or white produces black or white.</td>
  579. </tr>
  580. <tr>
  581. <td>soft-light</td>
  582. <td>Darkens or lightens the colors, dependent on the source color value. If the source color is lighter than 0.5, the destination is lightened. If the source color is darker than 0.5, the destination is darkened, as if it were burned in. The degree of darkening or lightening is proportional to the difference between the source color and 0.5. If it is equal to 0.5, the destination is unchanged. Painting with pure black or white produces a distinctly darker or lighter area, but does not result in pure black or white.</td>
  583. </tr>
  584. <tr>
  585. <td>plus</td>
  586. <td>The source is added to the destination and replaces the destination. This operator is useful for animating a dissolve between two images.</td>
  587. </tr>
  588. <tr>
  589. <td>add</td>
  590. <td>As per 'plus' but transparency data is treated as matte
  591. values. As such any transparent areas in either image remain
  592. transparent. </td>
  593. </tr>
  594. <tr>
  595. <td>minus</td>
  596. <td>Subtract the colors in the source image from the
  597. destination image. When transparency is involved, Opaque areas will be
  598. subtracted from any destination opaque areas. </td>
  599. </tr>
  600. <tr>
  601. <td>subtract</td>
  602. <td>Subtract the colors in the source image from the
  603. destination image. When transparency is involved transparent areas are
  604. subtracted, so only the opaque areas in the source remain opaque in
  605. the destination image. </td>
  606. </tr>
  607. <tr>
  608. <td>difference</td>
  609. <td>Subtracts the darker of the two constituent colors from the lighter. Painting with white inverts the destination color. Painting with black produces no change.</td>
  610. </tr>
  611. <tr>
  612. <td>exclusion</td>
  613. <td>Produces an effect similar to that of 'difference', but appears as lower contrast. Painting with white inverts the destination color. Painting with black produces no change.</td>
  614. </tr>
  615. <tr>
  616. <td>xor</td>
  617. <td>The part of the source that lies outside of the destination is combined with the part of the destination that lies outside of the source.</td>
  618. </tr>
  619. <tr>
  620. <td>copy-*</td>
  621. <td>Copy the specified channel in the source image to the
  622. same channel in the destination image. If the channel specified in
  623. the source image does not exist, (which can only happen for methods,
  624. '<samp>copy-opacity</samp>' or '<samp>copy-black</samp>') then it is
  625. assumed that the source image is a special grayscale channel image
  626. of the values to be copied. </td>
  627. </tr>
  628. <tr>
  629. <td>change-mask</td>
  630. <td>Replace any destination pixel that is the similar to the source images pixel (as defined by the current <a href="magick-vector-graphics.html#fuzz">-fuzz</a> factor), with transparency. </td>
  631. </tr>
  632. </tbody>
  633. </table></td>
  634. </tr>
  635. <tr>
  636. <td><a class="anchor" id="interline-spacing"></a>interline-spacing <var>pixels</var></td>
  637. <td></td>
  638. </tr>
  639. <tr>
  640. <td><a class="anchor" id="interword-spacing"></a>interword-spacing <var>pixels</var></td>
  641. <td></td>
  642. </tr>
  643. <tr>
  644. <td><a class="anchor" id="kerning"></a>kerning <var>pixels</var></td>
  645. <td></td>
  646. </tr>
  647. <tr>
  648. <td><a class="anchor" id="line"></a>line <var>x,y x<sub>1</sub>,y<sub>1</sub></var></td>
  649. <td></td>
  650. </tr>
  651. <tr>
  652. <td><a class="anchor" id="matte"></a>matte <var>x,y method</var></td>
  653. <td>Choose from these methods:
  654. <pre class="bg-light text-dark mx-4"><samp>point
  655. replace
  656. floodfill
  657. filltoborder
  658. reset</samp></pre></td>
  659. </tr>
  660. <tr>
  661. <td><a class="anchor" id="offset"></a>offset <var>offset</var></td>
  662. <td></td>
  663. </tr>
  664. <tr>
  665. <td><a class="anchor" id="opacity"></a>opacity <var>opacity</var></td>
  666. <td>Use percent (e.g. 50%).</td>
  667. </tr>
  668. <tr>
  669. <td><a class="anchor" id="path"></a>path <var>path</var></td>
  670. <td></td>
  671. </tr>
  672. <tr>
  673. <td><a class="anchor" id="point"></a>point <var>x,y</var></td>
  674. <td></td>
  675. </tr>
  676. <tr>
  677. <td><a class="anchor" id="polygon"></a>polygon <var>x,y x<sub>1</sub>,y<sub>1</sub>, ..., x<sub>n</sub>,y<sub>n</sub></var></td>
  678. <td></td>
  679. </tr>
  680. <tr>
  681. <td><a class="anchor" id="polyline"></a>polyline <var>x,y x<sub>1</sub>,y<sub>1</sub>, ..., x<sub>n</sub>,y<sub>n</sub></var></td>
  682. <td></td>
  683. </tr>
  684. <tr>
  685. <td><a class="anchor" id="pop-clip-path"></a>pop clip-path</td>
  686. <td></td>
  687. </tr>
  688. <tr>
  689. <td><a class="anchor" id="pop-defs"></a>pop defs</td>
  690. <td></td>
  691. </tr>
  692. <tr>
  693. <td><a class="anchor" id="pop-gradient"></a>pop gradient</td>
  694. <td></td>
  695. </tr>
  696. <tr>
  697. <td><a class="anchor" id="pop-graphic-context"></a>pop graphic-context</td>
  698. <td></td>
  699. </tr>
  700. <tr>
  701. <td><a class="anchor" id="pop-pattern"></a>pop pattern</td>
  702. <td></td>
  703. </tr>
  704. <tr>
  705. <td><a class="anchor" id="push"></a>push clip-path "<var>name</var>"</td>
  706. <td></td>
  707. </tr>
  708. <tr>
  709. <td><a class="anchor" id="push-defs"></a>push defs</td>
  710. <td></td>
  711. </tr>
  712. <tr>
  713. <td><a class="anchor" id="push-gradient-linear"></a>push gradient <var>id linear x,y x<sub>1</sub>,y<sub>1</sub></var></td>
  714. <td></td>
  715. </tr>
  716. <tr>
  717. <td><a class="anchor" id="push-gradient-radial"></a>push gradient <var>id radial x<sub>c</sub>,c<sub>y</sub> x<sub>f</sub>,y<sub>f</sub> radius</var></td>
  718. <td></td>
  719. </tr>
  720. <tr>
  721. <td><a class="anchor" id="push-graphic-context"></a>push graphic-context { "<var>id</var>" }</td>
  722. <td>the <em>id</em> is optional</td>
  723. </tr>
  724. <tr>
  725. <td><a class="anchor" id="push-pattern"></a>push pattern <var>id x,y width,height</var></td>
  726. <td></td>
  727. </tr>
  728. <tr>
  729. <td><a class="anchor" id="rectangle"></a>rectangle <var>x,y x<sub>1</sub>,y<sub>1</sub></var></td>
  730. <td></td>
  731. </tr>
  732. <tr>
  733. <td><a class="anchor" id="rotate"></a>rotate <var>angle</var></td>
  734. <td></td>
  735. </tr>
  736. <tr>
  737. <td><a class="anchor" id="roundrectangle"></a>roundrectangle <var>x,y x<sub>1</sub>,y<sub>1</sub> width,height</var></td>
  738. <td></td>
  739. </tr>
  740. <tr>
  741. <td><a class="anchor" id="scale"></a>scale <var>x,y</var></td>
  742. <td></td>
  743. </tr>
  744. <tr>
  745. <td><a class="anchor" id="skewX"></a>skewX <var>angle</var></td>
  746. <td></td>
  747. </tr>
  748. <tr>
  749. <td><a class="anchor" id="skewY"></a>skewX <var>angle</var></td>
  750. <td></td>
  751. </tr>
  752. <tr>
  753. <td><a class="anchor" id="stop-color"></a>stop-color <var>color offset</var></td>
  754. <td></td>
  755. </tr>
  756. <tr>
  757. <td><a class="anchor" id="stroke"></a>stroke <var>color</var></td>
  758. <td></td>
  759. </tr>
  760. <tr>
  761. <td><a class="anchor" id="stroke-antialias"></a>stroke-antialias <var>0 • 1</var></td>
  762. <td></td>
  763. </tr>
  764. <tr>
  765. <td><a class="anchor" id="stroke-dasharray"></a>stroke-dasharray <var>none • numeric-list</var></td>
  766. <td></td>
  767. </tr>
  768. <tr>
  769. <td><a class="anchor" id="stroke-dashoffset"></a>stroke-dashoffset <var>offset</var></td>
  770. <td></td>
  771. </tr>
  772. <tr>
  773. <td><a class="anchor" id="stroke-linecap"></a>stroke-linecap <var>type</var></td>
  774. <td>Choose from these cap types:
  775. <pre class="bg-light text-dark mx-4"><samp>butt
  776. round
  777. square</samp></pre></td>
  778. </tr>
  779. <tr>
  780. <td><a class="anchor" id="stroke-linejoin"></a>stroke-linejoin <var>type</var></td>
  781. <td>Choose from these join types:
  782. <pre class="bg-light text-dark mx-4"><samp>bevel
  783. miter
  784. round</samp></pre></td>
  785. </tr>
  786. <tr>
  787. <td><a class="anchor" id="stroke-miterlimit"></a>stroke-miterlimit <var>limit</var></td>
  788. <td></td>
  789. </tr>
  790. <tr>
  791. <td><a class="anchor" id="stroke-opacity"></a>stroke-opacity <var>opacity</var></td>
  792. <td>The opacity ranges from 0.0 (fully transparent) to 1.0 (fully opaque) or as a percentage (e.g. 50%).</td>
  793. </tr>
  794. <tr>
  795. <td><a class="anchor" id="stroke-width"></a>stroke-width <var>width</var></td>
  796. <td></td>
  797. </tr>
  798. <tr>
  799. <td><a class="anchor" id="text"></a>text <var>"text"</var></td>
  800. <td></td>
  801. </tr>
  802. <tr>
  803. <td><a class="anchor" id="text-antialias"></a>text-antialias <var>0 • 1</var></td>
  804. <td></td>
  805. </tr>
  806. <tr>
  807. <td><a class="anchor" id="text-undercolor"></a>text-undercolor <var>color</var></td>
  808. <td></td>
  809. </tr>
  810. <tr>
  811. <td><a class="anchor" id="translate"></a>translate <var>x,y</var></td>
  812. <td></td>
  813. </tr>
  814. <tr>
  815. <td><a class="anchor" id="use"></a>use "<var>url(#id)</var>"</td>
  816. <td></td>
  817. </tr>
  818. <tr>
  819. <td><a class="anchor" id="viewbox"></a>viewbox <var>x,y x<sub>1</sub>,y<sub>1</sub></var></td>
  820. <td></td>
  821. </tr>
  822. </tbody>
  823. </table></div>
  824. <p>Note, the primitives are case sensitive, e.g., use <code>viewbox</code>, not <code>viewBox</code>.</p>
  825. </div>
  826. </div>
  827. </main><!-- /.container -->
  828. <footer class="magick-footer">
  829. <div class="container-fluid">
  830. <a href="security-policy.html">Security</a> •
  831. <a href="news.html">News</a>
  832. <a href="magick-vector-graphics.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
  833. <a href="links.html">Related</a> •
  834. <a href="sitemap.html">Sitemap</a>
  835. <br/>
  836. <a href="support.html">Sponsor</a> •
  837. <a href="cite.html">Cite</a> •
  838. <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
  839. <a href="https://imagemagick.org/script/contact.php">Contact Us</a>
  840. <br/>
  841. <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> •
  842. <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>
  843. <br/>
  844. <small>Copyright © 1999 ImageMagick Studio LLC</small>
  845. </div>
  846. </footer>
  847. <!-- Javascript assets -->
  848. <script src="assets/magick.js" ></script>
  849. </body>
  850. </html>
  851. <!-- Magick Cache 12th September 2023 23:58 -->