Nodes/ComfyUI-ToSVG/Raster to Vector (SVG)Color
ComfyUI Node

Raster to Vector (SVG)Color

Where this pack actually gets interesting

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

Let's get the rename out of the way: ConvertRasterToVectorColor is the old name. The ComfyUI-ToSVG pack's June 17 update renamed it to TS_ImageToSVGStringColor_Vtracer (same inputs, same output, same behavior), and the current code only ships the new class. If a stale workflow points at this name, swap in the TS_ version. Fine. Now the interesting part.

Black-and-white tracing is easy for a machine - one threshold, done. Color tracing is where it gets fun, because the tracer has to decide how to carve a full-color bitmap into stacked layers of shapes, each with a fill color, without turning your image into a 40 MB mess. That's what this node does, via visioncortex/vtracer with colormode="color".

The inputs that matter

You get the same shared knobs as the BW node - mode, filter_speckle, corner_threshold, length_threshold, splice_threshold - plus the color-specific ones:

  • hierarchical - stacked or cutout. Stacked builds the image as layers painted on top of each other (smaller files, slightly less accurate edges); cutout carves shapes that fit together like a jigsaw (more accurate, heavier).
  • color_precision - the README's "more accurate" dial. Higher = more color layers, truer to the original.
  • layer_difference - the README calls this the gradient-step control; it sets how much the tracer tolerates between layers, so it effectively decides "less layers" as you raise it.
  • max_iterations - how hard the algorithm works on edge refinement. More is better quality and slower.
  • path_precision - how precisely paths follow edges. Higher is heavier output.

Output is a STRING, one per image in the batch. Wire it to TS_SVGStringPreview to look, TS_SaveSVGString to save, or TS_SVGStringToImage to rasterize back into the pixel pipeline.

Where color vectorization earns its keep

This is the path people use when they want more than a flat logo: vectorizing generated illustrations or icons with a handful of flat colors, prepping art for screen printing (where each layer is a separate screen), or feeding a cricut/laser workflow that needs color-separated SVG. The "Flux Icon Maker" style workflows - the ones that blew up on r/StableDiffusion - lean on exactly this kind of output for icons and design assets.

Two honest warnings. First, trace quality lives or dies by your source: something with large flat color regions traces beautifully; noisy or photorealistic output turns into a bloated, muddy SVG. Run TS_ImageQuantize first to collapse the palette, and suddenly the same image traces clean. Second, the defaults are a starting point, not a promise - if your result has speckles, raise filter_speckle; if colors smear together, raise color_precision and lower layer_difference.

Installing it

One install covers all the pack's nodes. 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

Dependencies are vtracer, numpy, Pillow, torch, PyMuPDF, and potracer - no model files, no API keys, all local CPU work. If fitz ever refuses to import after an update, reinstall PyMuPDF; that compiled dependency is the usual suspect when this pack's requirements collide with another node pack's.

Category💎TOSVG

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—