Load SVG Image
Drag an SVG In, Get the Text Out
- svg_text
- preview_image
Core ComfyUI has a Load Image node that reads PNGs, JPGs, and WebP - but not SVG. If you've ever tried to feed a logo or a vector asset into a workflow, you know that dead end: no node, no drop target, nothing. This is the node that plugs that hole. Load SVG Image (class LoadSVGImage) from the ComfyUI-Svg2Raster pack reads an .svg file and hands you two things at once: the raw SVG as text, and a rasterized preview image you can wire straight into the rest of your graph.
Why would you care about SVG in the first place? Because vector art is resolution-independent. Logos, icons, ControlNet conditioning poses - render them at 512 or 2048 and they stay perfectly crisp, no upscale blur. The ComfyUI ecosystem is slowly waking up to that (there's even a whole OpenPose-to-SVG movement for editing pose skeletons in Inkscape), and this pack is a two-node entry point into it.
How it works
The node does the boring, necessary work: it lists every .svg file in your ComfyUI input folder as a dropdown choice, reads the file as UTF-8 text, and renders a preview with CairoSVG. The input is the standard svg file picker (upload support enabled), so you can either drop a file into ComfyUI/input/ and refresh, or just drag one straight onto the node - ComfyUI copies it into input for you.
Two outputs come out of it:
svg_text(STRING) - the raw SVG markup as a string. This is the one you care about. It's the natural companion to the pack's other node,SVG Rasterizer (Simple): wiresvg_textinto that and you control the exact output resolution, background, and border.preview_image(IMAGE) - a rasterized preview rendered at the SVG's native size. Good for eyeballing what you loaded or for wiring directly into an image pipeline if you don't care about resolution control.
One nice detail: the node hashes the file to detect changes (IS_CHANGED), so if you edit the SVG on disk, ComfyUI re-runs instead of serving you a cached stale preview. That's the kind of small thing that keeps a utility node from becoming an annoyance.
Installing it
Same story for both nodes in the pack:
- Install Cairo as a system dependency first - the README calls this out in bold, and it's the whole ballgame. Linux:
apt install libcairo2-dev pkg-config(or your distro's equivalent). macOS:brew install cairo. Windows: install the GTK/Cairo runtime from cairographics.org. - In ComfyUI Manager, search "ComfyUI-Svg2Raster" and install. Or manually:
cd ComfyUI/custom_nodes git clone https://github.com/garg-aayush/ComfyUI-Svg2Raster.git pip install -r requirements.txt # cairosvg, pillow, numpy - Restart ComfyUI. Find both nodes under the FromSVG/Tools menu.
No models, no API keys, nothing to download beyond Cairo and three lightweight Python packages.
Where people get burned
The Cairo system dependency is the trap. Manager installs the Python packages happily, and then CairoSVG fails at runtime because the underlying native library isn't there. If you see a Cairo-related error on first run, that's what happened - it's a system install, not something pip can fix. Also note the security reality of custom nodes generally: you're running arbitrary Python on import, so it's worth a skim of the source before you trust any pack, this one included. It's two tiny files; easy to eyeball.
Beyond that, this node is about as simple as they come. If your SVG won't validate, check it's actually a file in input and not a stray path - the node refuses to load anything that doesn't resolve.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| svg | COMBO | 0 options: |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| svg_text | STRING | — |
| preview_image | IMAGE | — |