Nodes/ComfyUI-ToSVG/Image to SVG String Color_Vtracer
ComfyUI Node

Image to SVG String Color_Vtracer

Trace a full-color image into layered SVG, one node at a time

By Yanick112·Created 2 years ago·Updated about a year ago· 314
Image to SVG String Color_Vtracer
  • image
  • STRING
â—„hierarchicalstackedâ–º
â—„modesplineâ–º
â—„filter_speckle4â–º
â—„color_precision6â–º
â—„layer_difference16â–º
â—„corner_threshold60â–º
â—„length_threshold4.0â–º
â—„max_iterations10â–º
â—„splice_threshold45â–º
â—„path_precision3â–º

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) and layer_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.

Category💎TOSVG/Convert

Inputs (11)

NameTypeDefaultDescription
imageIMAGE—
hierarchicalCOMBOstacked2 options: stacked, cutout
modeCOMBOspline3 options: spline, polygon, none
filter_speckleINT40–100—
color_precisionINT60–10—
layer_differenceINT160–256—
corner_thresholdINT600–180—
length_thresholdFLOAT4.00–10—
max_iterationsINT101–70—
splice_thresholdINT450–180—
path_precisionINT30–10—

Outputs (1)

NameTypeDescription
STRINGSTRING—