Raster to Vector (SVG)
Trace a generated image into clean vectors
- image
- LIST
Diffusion models paint pixels. Sometimes you want paths instead - a logo, an icon, a piece of flat art you can scale to any size, recolor, or hand to a designer. This node turns a raster image into an SVG by tracing it, so you can vectorize something you just generated without leaving ComfyUI.
It's a nice bridge. The only closed model that generates true vectors natively is Recraft V3 (the knowledge base flags it as the one image generator with SVG output, and it's paid and closed). Everything open produces pixels, so tracing is how the open workflow gets to vectors - you generate the art normally, then convert.
How it works
The conversion runs on vtracer, a fast Rust image-to-SVG tracer. It doesn't "understand" the image; it clusters regions of similar color and fits vector paths around them. That mechanism decides everything about what this node is good at: flat, limited-color art (logos, badges, line art, simple illustration) traces cleanly, while a photograph or a busy render turns into a spaghetti of thousands of tiny paths and a bloated file. Match the input to the tool and it's great; ignore that and you'll wonder why your "vector" is 4MB.
The inputs that matter
The node exposes vtracer's full knob set. You'll rarely touch most of them, but a few earn their keep:
colormode-colorfor full-color tracing,binaryfor a one-color silhouette (great for stencils and single-color logos).mode-splinefor smooth curves (the default, and what you want for organic shapes),polygonfor straight-edged, angular output.filter_speckle(default 4) - drops clusters smaller than this many pixels. Turn it up to kill noise and stray dots; the single most useful dial for a clean result.color_precision(default 8) - how many color levels to keep. Lower it for a poster-ized, fewer-colors look and a smaller file.
The rest (corner_threshold, length_threshold, max_iterations, splice_threshold, path_precision) are fine-tuning for how aggressively curves are simplified and joined. The defaults are sensible; leave them until you have a specific edge artifact to chase.
The output is a LIST of SVG strings - text, not an image. You can't preview it directly, which trips people up. Feed it into the pack's Gemini Save SVG node, which writes the .svg file to disk and renders a preview you can actually see.
Installing it
It ships in the ComfyUI-OllamaGemini pack. Install via ComfyUI Manager (search ComfyUI-OllamaGemini, install, restart) or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
pip install -r requirements.txt
then restart. The conversion needs the vtracer Python package, which comes in via requirements.txt - if the node errors on execution complaining it can't import vtracer, that install step didn't complete, so re-run the pip install inside the pack folder.
Where people get burned
The number-one mistake is tracing a photo. Vectorization is for flat graphics; run it on a photorealistic render and you get an enormous file made of countless paths that looks worse than the original and opens slowly everywhere. If you want vectors, generate art that's meant to be flat - bold shapes, limited palette - or posterize first.
The second gotcha is expecting a picture out of this node. It emits SVG strings; nothing renders until you pass them to Gemini Save SVG. And if edges come out ragged, reach for filter_speckle (raise it) and color_precision (lower it) before fiddling with the corner and length thresholds. The pack also has a near-identical Gemini Convert Raster to Vector node that adds one extra optimize toggle - same vtracer engine underneath.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| colormode | COMBO | color | 2 options: color, binary |
| mode | COMBO | spline | 2 options: spline, polygon |
| filter_speckle | INT | 40–20 | — |
| color_precision | INT | 81–16 | — |
| corner_threshold | INT | 800–180 | — |
| length_threshold | FLOAT | 2.000.5–10 | — |
| max_iterations | INT | 151–50 | — |
| splice_threshold | INT | 450–180 | — |
| path_precision | INT | 51–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |