Converting from SVG#
Use the SVG functions when another tool has already produced the vector image. VlConvert converts it to PNG, JPEG, or PDF without running Vega.
The SVG must declare its size through width and height attributes or a viewBox. Fonts and images it references must be available to the rendering process. See Fonts and Google Fonts and Security and Network Access when the SVG is not self-contained.
Save this SVG document:
chart.svg
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="120" viewBox="0 0 320 120">
<rect width="320" height="120" rx="8" fill="#f3f6fa"/>
<circle cx="60" cy="60" r="32" fill="#4c78a8"/>
<path d="M118 84 L158 28 L198 84 Z" fill="#f58518"/>
<rect x="230" y="28" width="64" height="64" rx="6" fill="#54a24b"/>
</svg>
$ vl-convert svg2png --input chart.svg --output chart.png --scale 2
$ vl-convert svg2pdf --input chart.svg --output chart.pdf
svg2jpeg produces JPEG. svg2png accepts --scale and --ppi, svg2jpeg accepts --scale and --quality, and svg2pdf has no format options.
The PNG conversion preserves the shapes and colors in the SVG document:
See Image Size and Quality Recommendations for the scale, ppi, and quality options.