Nodes/ComfyUI-NeuralMedia/πŸ–ŒοΈ VTracer (Image vectorizer)
ComfyUI Node

πŸ–ŒοΈ VTracer (Image vectorizer)

Raster to SVG inside ComfyUI, for logos and laser files

By YarvixPAΒ·Created 2 years agoΒ·Updated about a year agoΒ· 5
πŸ–ŒοΈ VTracer (Image vectorizer)
  • image
    β—„colormodecolorβ–Ί
    β—„hierarchicalstackedβ–Ί
    β—„modesplineβ–Ί
    β—„filter_speckle4β–Ί
    β—„color_precision6β–Ί
    β—„layer_difference16β–Ί
    β—„corner_threshold60β–Ί
    β—„length_threshold4.00β–Ί
    β—„max_iterations10β–Ί
    β—„splice_threshold45β–Ί
    β—„path_precision3β–Ί
    β—„save_formatSVGβ–Ί
    β—„filename_prefixComfyUIβ–Ί

    Vectorize the image on your canvas - no leaving ComfyUI, no external website. VTracer is the well-known open-source raster-to-vector engine (the one a lot of web tools and even SVG-dataset projects quietly rely on), and this node wraps it: feed it an image, get back an SVG file in your output directory, ready for Inkscape, a laser cutter, a plotter, or a print shop. If your pipeline ends in "give this to a machine that cuts things," this node is the bridge.

    It's a niche node and knows it. But it's a genuinely good niche: pixel images upscale poorly, vectors don't. So when a generated logo, sticker design, or engraving pattern needs to survive scaling from business-card to billboard, tracing it to vector is the right move, and doing it in-graph keeps the workflow reproducible.

    How it works

    Under the hood it hands the image to vtracer.convert_pixels_to_svg - a proper auto-tracer that builds paths from the image's color regions, not a cheap "embed the raster in an SVG" hack - and writes the result to ComfyUI/output with a filename_prefix you choose. It can also save as PDF, by tracing to SVG and then converting via svglib/reportlab (the temporary SVG is deleted afterward).

    The rest of the inputs are VTracer's own tuning knobs, passed straight through:

    • colormode - color or binary (two-tone, for line art and engraving).
    • mode - spline (smooth curves), polygon (straight segments), or none (raw outlines).
    • filter_speckle - drops tiny specks/noise; higher = cleaner but lossier. Default 4.
    • color_precision - how many colors to keep (default 6; lower = flatter, more posterized).
    • layer_difference - color-layering tolerance, 1–30.
    • corner_threshold, length_threshold, max_iterations, splice_threshold, path_precision - path-shape parameters. Defaults are sane; tune them only when spline output looks lumpy.
    • hierarchical - stacked or cutout; how color layers nest.
    • save_format - SVG or PDF.

    For a first pass: leave everything, set colormode to binary if the image is meant as line art, and look at the SVG. Tune color_precision and filter_speckle before anything else - they do 80% of the visible work.

    Install

    This node pulls in the heavy dependencies - vtracer (a Rust-backed wheel), plus svgwrite, svglib, and reportlab for the PDF path. That's why it's worth calling out: the pack's requirements.txt is shared, and this node is a big chunk of it.

    cd ComfyUI/custom_nodes
    git clone https://github.com/YarvixPA/ComfyUI-NeuralMedia
    cd ComfyUI-NeuralMedia
    pip install -r requirements.txt
    

    or ComfyUI Manager β†’ search ComfyUI-NeuralMedia, restart ComfyUI. If the clone 404s (the repo has moved around), Manager's registry entry is the reliable route.

    Common issues

    • PDF mode fails. It needs svglib and reportlab installed. If your environment predates the requirements update, run pip install svglib reportlab and restart.
    • Output is a blobby mess. The image probably has gradients or noise. Flatten it first - posterize, reduce colors - or raise filter_speckle and lower color_precision.
    • The SVG looks fine but is huge. High color_precision on a busy image produces thousands of paths. Dial it down for clean output; VTracer is fast, but massive SVGs are annoying everywhere downstream.

    The honest take

    This is the rare pack node with no real equivalent in core ComfyUI, and it's the one worth installing for if your work touches physical output. For everything else it's a fun toy that occasionally saves you a trip to a web tracer. Know what you're buying: automatic tracing is good, not magical - clean flat images vectorize beautifully, photographic ones don't.

    CategoryComfyUI-NeuralMedia

    Inputs (14)

    NameTypeDefaultDescription
    imageIMAGEβ€”
    colormodeCOMBOcolor2 options: color, binary
    hierarchicalCOMBOstacked2 options: stacked, cutout
    modeCOMBOspline3 options: spline, polygon, none
    filter_speckleINT41–10β€”
    color_precisionINT61–10β€”
    layer_differenceINT161–30β€”
    corner_thresholdINT601–120β€”
    length_thresholdFLOAT4.003.5–10β€”
    max_iterationsINT101–20β€”
    splice_thresholdINT451–90β€”
    path_precisionINT31–8β€”
    save_formatCOMBOSVG2 options: SVG, PDF
    filename_prefixSTRINGComfyUIβ€”

    Outputs (0)

    No outputs