2 Quick Start
The four functions you’ll likely reach for first are svg-string->bitmap,
svg-file->bitmap, svg-string->pict, and svg-file->pict
—
(require svg/svg racket/class) (define bm (svg-string->bitmap #<<SVG <svg width="160" height="120" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="gold"/> <stop offset="100%" stop-color="crimson"/> </linearGradient> </defs> <rect x="10" y="10" width="140" height="60" rx="10" fill="url(#g)"/> <circle cx="40" cy="95" r="18" fill="steelblue" stroke="black" stroke-width="2"/> <circle cx="80" cy="95" r="18" fill="seagreen" stroke="black" stroke-width="2"/> <circle cx="120" cy="95" r="18" fill="orange" stroke="black" stroke-width="2"/> </svg> SVG )) (send bm save-file "out.png" 'png)

Swap svg-string->bitmap for svg-string->pict and you get a
pict instead of a bitmap% —
(require svg/svg pict) (define badge (svg-string->pict "...")) ; same SVG string as above (hc-append 16 (text "A pict:" '(bold) 16) (frame badge))

svg-file->bitmap and svg-file->pict are the file-path equivalents; use them (rather than reading a file yourself and passing the string to svg-string->bitmap/svg-string->pict) whenever the SVG has relative <image> references, since only the file-path versions know what directory to resolve those against.
Filters, masks, and group opacity all compose the way you’d expect from a
browser —

If all you need is one of those four top-level functions, you can stop
reading here. The rest of this document covers the lower-level pieces
(path-data parsing, paint resolution, transform matrices, and so on) that
svg/svg also exports, in case you want to reuse a piece of the
pipeline directly —