ImageMagick Magick Vector Graphics
-Introduction to Vector Graphics
+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 command line, from an MVG file, from an SVG -- Scalable Vector Graphics file or from one of the ImageMagick program interfaces. Use this command, for example, to render an arc:
- $magick> convert -size 100x60 xc:skyblue -fill white -stroke black \ $magick> convert -size 100x60 canvas:skyblue -fill white -stroke black \ and here is the result: When the drawing gets sufficiently complex, we recommend you assemble the graphic primitives into a MVG file. For our example, we use piechart.mvg: to render a pie chart with this command: Drawing is available from many of the ImageMagick program interfaces as well. ImageMagick converts the drawing API calls to MVG and renders it. Here is example code written in the MagickWand language:
+
-draw "path 'M 30,40 A 30,20 20 0,0 70,20 A 30,20 20 1,0 30,40 Z '" \
arc.png
MVG Overview
+MVG Overview
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 new line 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.
@@ -470,43 +509,43 @@ command line, from an MVG file, from an SVGDrawing Primitives
+Drawing Primitives
Here is a complete description of the MVG drawing primitives:
-
-
- affine sx,rx,ry,sy,tx,ty +
- affine sx,rx,ry,sy,tx,ty -
- arc x0,y0 x1,y1 a0,a1 +
- arc x0,y0 x1,y1 a0,a1 -
- bezier x0,y0 ... xn,yn +
- bezier x0,y0 ... xn,yn
-
Bezier (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 Path primitive or to draw multiple four-point bezier segments with the start and end knots of each successive segment repeated.
- - border-color color +
- border-color color -
- circle originx,originy perimeterx,perimetery +
- circle originx,originy perimeterx,perimetery -
- clip-path url(name) +
- clip-path url(name) -
- clip-rule rule +
- clip-rule rule
- Choose from these rule types: @@ -516,7 +555,7 @@ command line, from an MVG file, from an SVG -
- clip-units units +
- clip-units units
- Choose from these unit types: @@ -527,7 +566,7 @@ command line, from an MVG file, from an SVG -
- color x,y method +
- color x,y method @@ -551,7 +590,7 @@ command line, from an MVG file, from an SVG -
- decorate type +
- decorate type
- Choose from these types of decorations: @@ -565,20 +604,20 @@ command line, from an MVG file, from an SVG -
- ellipse centerx,centery radiusx,radiusy arcstart,arcstop +
- ellipse centerx,centery radiusx,radiusy arcstart,arcstop -
- fill color +
- fill color
- Choose from any of these colors. -
- fill-opacity opacity +
- fill-opacity opacity
- The opacity ranges from 0.0 (fully transparent) to 1.0 (fully opaque) or as a percentage (e.g. 50%). -
- fill-rule rule +
- fill-rule rule
- Choose from these rule types: @@ -590,19 +629,19 @@ command line, from an MVG file, from an SVG -
- font name +
- font name -
- font-family family +
- font-family family -
- font-size point-size +
- font-size point-size -
- font-stretch type +
- font-stretch type
- Choose from these stretch types: @@ -621,7 +660,7 @@ command line, from an MVG file, from an SVG -
- font-style style +
- font-style style
- Choose from these styles: @@ -635,7 +674,7 @@ command line, from an MVG file, from an SVG -
- font-weight weight +
- font-weight weight
- Choose from these weights: @@ -656,7 +695,7 @@ command line, from an MVG file, from an SVG -
- gradient-units units +
- gradient-units units
- Choose from these units: @@ -668,7 +707,7 @@ command line, from an MVG file, from an SVG -
- gravity type +
- gravity type
- Choose from these gravity types: @@ -686,7 +725,7 @@ command line, from an MVG file, from an SVG -
- image compose x,y width,height 'filename' +
- image compose x,y width,height 'filename'
- Choose from these compose operations: @@ -863,23 +902,23 @@ command line, from an MVG file, from an SVG -
- interline-spacing pixels +
- interline-spacing pixels -
- interword-spacing pixels +
- interword-spacing pixels -
- kerning pixels +
- kerning pixels -
- line x,y x1,y1 +
- line x,y x1,y1 -
- matte x,y method +
- matte x,y method
- Choose from these methods: @@ -893,119 +932,119 @@ command line, from an MVG file, from an SVG -
- offset offset +
- offset offset -
- opacity opacity +
- opacity opacity
- Use percent (e.g. 50%). -
- path path +
- path path -
- point x,y +
- point x,y -
- polygon x,y x1,y1, ..., xn,yn +
- polygon x,y x1,y1, ..., xn,yn -
- polyline x,y x1,y1, ..., xn,yn +
- polyline x,y x1,y1, ..., xn,yn -
- pop clip-path +
- pop clip-path -
- pop defs +
- pop defs -
- pop gradient +
- pop gradient -
- pop graphic-context +
- pop graphic-context -
- pop pattern +
- pop pattern -
- push clip-path name +
- push clip-path name -
- push defs +
- push defs -
- push gradient id linear x,y x1,y1 +
- push gradient id linear x,y x1,y1 -
- push gradient id radial xc,cy xf,yf radius +
- push gradient id radial xc,cy xf,yf radius -
- push graphic-context +
- push graphic-context -
- push pattern id radial x,y width,height +
- push pattern id radial x,y width,height -
- rectangle x,y x1,y1 +
- rectangle x,y x1,y1 -
- rotate angle +
- rotate angle -
- roundrectangle x,y x1,y1 width,height +
- roundrectangle x,y x1,y1 width,height -
- scale x,y +
- scale x,y -
- skewX angle +
- skewX angle -
- skewX angle +
- skewX angle -
- stop-color color offset +
- stop-color color offset -
- stroke color +
- stroke color -
- stroke-antialias 0 • 1 +
- stroke-antialias 0 • 1 -
- stroke-dasharray none • numeric-list +
- stroke-dasharray none • numeric-list -
- stroke-dashoffset offset +
- stroke-dashoffset offset -
- stroke-linecap type +
- stroke-linecap type
- Choose from these cap types: @@ -1018,7 +1057,7 @@ command line, from an MVG file, from an SVG -
- stroke-linejoin type +
- stroke-linejoin type
- Choose from these join types: @@ -1030,36 +1069,36 @@ command line, from an MVG file, from an SVG -
- stroke-miterlimit limit +
- stroke-miterlimit limit -
- stroke-opacity opacity +
- stroke-opacity opacity
- The opacity ranges from 0.0 (fully transparent) to 1.0 (fully opaque) or as a percentage (e.g. 50%). -
- stroke-width width +
- stroke-width width -
- text "text" +
- text "text" -
- text-antialias 0 • 1 +
- text-antialias 0 • 1 -
- text-undercolor color +
- text-undercolor color -
- translate x,y +
- translate x,y -
- viewbox x,y x1,y1 +
- viewbox x,y x1,y1 @@ -1080,7 +1119,7 @@ command line, from an MVG file, from an SVG