VPype SVG Processor
Your AI image is not a plot — this node fixes that
- svg_output
The SVG that a tracer hands you after running an AI image through Potrace-style conversion is plotting garbage. Thousands of tiny disconnected segments, specks of noise, paths drawn in an order that makes a pen zig-zag across the page like a ping-pong ball. If you're sending that straight to a plotter you're wasting hours of pen travel. VPypeProcessor is the clean-up pass that makes the difference between a smudgy mess and a plot that actually looks deliberate.
It's one of three nodes in boardmain/ComfyUI-Svg2Gcode (this one, an extended variant, and the G-code generator that comes after). Think of it as the "please make this plot-able" step: it takes an SVG, runs it through the excellent vpype plotting toolchain, and hands back a cleaned SVG.
How it works
Here's the honest bit: the node does almost nothing in Python. It shells out to the vpype command-line tool via subprocess, writes your SVG to a temp file, builds a vpype command string, and reads back the result. All the real muscle lives in vpype and its plugins. That matters for two reasons - it's why the install step is a bit heavier than a normal node, and it's the source of most of your future errors.
The pipeline it runs is: read the SVG, linemerge (join line ends that nearly touch), linesimplify (drop redundant points), optionally filter out short paths, linesort (order lines to minimize pen travel), optionally duplicate for multiple passes, rotate, and optionally scale-and-center on a page.
The inputs that actually matter
You get a wall of widgets; only a few need your attention.
svg_input(STRING, multiline) - the SVG content, usually wired from an image-to-SVG node. You can also paste SVG text straight in or give it a file path; it handles both.merge_tolerance(0.1 mm) - how close line ends have to be before they're glued together. Bump it up if your traced image comes out as hundreds of broken strokes.simplify_tolerance(0.05 mm) - how aggressively to remove points. Higher = smoother paths, less detail.min_length(0 = off) - drops paths shorter than this in mm. Your best weapon against noise speckles.multipass_count(0 = off) - duplicates the geometry so the pen draws over it multiple times, useful for ink-heavy papers.rotation(default 90) - yes, the shipped default is 90 degrees. If your plot comes out sideways, this is why; set it to 0 and fix it deliberately.perform_layoutwithmargin,width,height- scales and centers the whole design on a page (defaults to A4, 210×297 mm). Turn it off to keep your original SVG coordinates.
The single output, svg_output (STRING), wires straight into the VPypeGCodeGenerator next door. That's the whole point of the chain: image → SVG → this → G-code → plotter.
Installing it
Same story for all three nodes in the pack. Easiest is ComfyUI Manager: Custom Nodes Manager, search "ComfyUI-Svg2Gcode", install, restart. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/boardmain/ComfyUI-Svg2Gcode
cd ComfyUI-Svg2Gcode
pip install -r requirements.txt
The requirements are vpype, vpype-occult, and vpype-gcode - no model files, no GPU, just pip packages. But they install into the same Python environment ComfyUI runs in, so use whatever pip belongs to that env (a venv, your system Python, whatever your launcher uses).
Where people get burned
The classic failure is vpype not being found. Because the node shells out to the vpype executable, it has to be on the PATH of the process ComfyUI is running under - which is not always the same environment you installed packages into, especially on Windows where you launched ComfyUI from a shortcut. The code raises the exact error you'll see: "vpype executable not found. Please ensure it is installed and in your PATH." If you hit it, install vpype into the environment that actually starts ComfyUI, or verify vpype --version works in that same shell.
Worth knowing: this is a niche pack (the author's own announcement got a grand total of one upvote and zero comments), so don't expect a big support community around it. But it's MIT-licensed, the code is short, and for the one job it does - turning traced SVGs into clean plot paths - it's the thing I reach for.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| svg_input | STRING | — | |
| merge_tolerance | FLOAT | 0.100–10 | — |
| simplify_tolerance | FLOAT | 0.050–10 | — |
| min_length | FLOAT | 0.00–100 | — |
| multipass_count | INT | 00–50 | — |
| rotation | FLOAT | 90-360–360 | — |
| perform_layout | BOOLEAN | true | — |
| margin | FLOAT | 10.00–100 | — |
| width | FLOAT | 21010–5000 | — |
| height | FLOAT | 29710–5000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| svg_output | STRING | — |