Image to SVG String Color_Vtracer
Trace a full-color image into layered SVG, one node at a time
- image
- STRING
If you're here, you've found the current name of the pack's color vectorizer (it used to be ConvertRasterToVectorColor before the June 17 rename). This is the node that takes a full-color image - a generated illustration, a flat icon, a poster you made in Flux - and returns SVG text with actual color layers. Not a thresholded black-and-white silhouette: real stacked or cut-out shapes, each with its own fill.
That's a noticeably harder problem than binary tracing, which is why this node has more knobs than its black-and-white sibling and why it's the one people tune for a while before it clicks.
How it works
Under the hood it runs visioncortex/vtracer with colormode="color". The node converts your IMAGE tensor to a PIL image, makes sure it has an alpha channel, and passes the pixel data to vtracer.convert_pixels_to_svg(). The tracer clusters colors, builds a shape hierarchy, and emits an SVG per image in the batch. Output is a STRING list - one per frame.
The knobs, grouped by what they actually control
- Colors and layers:
color_precision(higher = more accurate colors, more layers) andlayer_difference(higher = fewer, more aggressively merged layers). These two are a seesaw: color accuracy up, layer count down. - Edge behavior:
mode(spline/polygon/none),corner_threshold(smoother),length_threshold(coarser segments),path_precision(how faithfully paths hug the edges). - Cleanup and effort:
filter_speckle(remove noise specks),splice_threshold(accuracy vs. output size),max_iterations(refinement effort, and cost). - hierarchical -
stacked(layers painted over each other; smaller files) vs.cutout(jigsaw-fit shapes; more accurate, heavier).
The realistic workflow
Vectorizing a raw generation rarely gives you a clean result on the first pass, and that's not the node's fault - the tracer faithfully reproduces whatever noise is in the source. The reliable order is: run TS_ImageQuantize first (drop the image to 8–16 colors), then feed that into this node, then preview with TS_SVGStringPreview or rasterize back with TS_SVGStringToImage to compare against the original. Save the good ones with TS_SaveSVGString.
That preprocessing step is the difference between "muddy 30 MB SVG" and "clean logo-ready file." Most people who complain about color tracing results are skipping it.
Install
Same as the whole pack. ComfyUI Manager → search ComfyUI-ToSVG → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Yanick112/ComfyUI-ToSVG/
cd ComfyUI-ToSVG
pip install -r requirements.txt
Requirements: vtracer, numpy, Pillow, torch, PyMuPDF, potracer. Nothing to download, no API keys, CPU-only - tracing is fast and doesn't need the GPU, so you can even run it on a machine that can't do diffusion at all. The only dependency that tends to bite is PyMuPDF: if you see a fitz import error after updating nodes, reinstall it, because another pack almost certainly pinned a conflicting version into the same Python environment.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| hierarchical | COMBO | stacked | 2 options: stacked, cutout |
| mode | COMBO | spline | 3 options: spline, polygon, none |
| filter_speckle | INT | 40–100 | — |
| color_precision | INT | 60–10 | — |
| layer_difference | INT | 160–256 | — |
| corner_threshold | INT | 600–180 | — |
| length_threshold | FLOAT | 4.00–10 | — |
| max_iterations | INT | 101–70 | — |
| splice_threshold | INT | 450–180 | — |
| path_precision | INT | 30–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |