# 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 {doc}`fonts` and {doc}`security` when the SVG is not self-contained. Save this SVG document: :::{dropdown} chart.svg :open: ```{literalinclude} /_examples/svg-demo.svg :language: xml ``` ::: ```python from pathlib import Path import vl_convert as vlc svg = Path("chart.svg").read_text(encoding="utf-8") png = vlc.svg_to_png(svg, scale=2) pdf = vlc.svg_to_pdf(svg) Path("chart.png").write_bytes(png) Path("chart.pdf").write_bytes(pdf) ``` Both results are bytes. `svg_to_jpeg()` produces JPEG. The PNG conversion preserves the shapes and colors in the SVG document: ```{vl-chart} /_examples/svg-demo.svg :input-kind: svg :format: png :scale: 2 :alt: A blue circle, orange triangle, and green square on a pale background ``` See {doc}`image-quality` for the `scale`, `ppi`, and `quality` options.