Convert IMG → SVG (1-bit)
Real vector tracing, with Potrace under the hood
- image
- svg_path
- svg_text
- preview
This node turns a raster image into an actual SVG - real paths, not a screenshot of pixels. It's the "vectorize" step that most ComfyUI image tools completely skip, and it's the reason anyone gets excited about the DAO pack in the first place. Feed it a logo or line drawing, and out comes svg_text you can pipe into the pack's SVG nodes, save to disk, or hand to a plotter.
The engine is Potrace, the classic open-source bitmap tracer by Peter Selinger. Here's the honest framing up front: Potrace is 1-bit. It produces exactly one foreground and one background color. That makes it outstanding for logos, stencils, vinyl cutting, and laser engraving, and genuinely wrong for photos - a photograph traced through Potrace comes out as a flat black-and-white mess. If you need multi-color tracing, this is not the tool. For single-color vector work, it rivals paid online vectorizers.
How it works
The pipeline is: convert to grayscale → binarize → trace. The threshold input (0–255, default 128) sets the binarization cutoff, but auto_otsu (on by default) computes an Otsu threshold from the image's histogram instead, which almost always beats a manual guess. invert flips which side counts as foreground - useful when your line art is black-on-white and you want the SVG to carry the ink.
Then the tracing knobs, all straight from Potrace: turdsize (drop specks smaller than this many pixels - crank it up to kill noise), alphamax (corner sharpness), opttolerance (curve simplification), turnpolicy (minority/majority/black/white/left/right), and fill_rule (nonzero/evenodd).
The backend selector is the one to know: auto uses the potrace binary if it's on your PATH and falls back to the pure-Python potrace module if not. Forcing potrace_bin gives the fastest, most battle-tested path; potrace_py is the no-install fallback.
Outputs: svg_path (the file it wrote, if save_svg is on - default output/svg/ with a timestamped name via auto_prefix), svg_text (the raw SVG as a SVG_TEXT string, ready for SVG Style, SVG Boolean, or Convert SVG → IMG), and preview (the binarized mask so you can see exactly what got traced without opening the file).
Installing
The pack installs via ComfyUI Manager (search ComfyUI_DAO_master) or:
cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI_DAO_master.git
and you'll want pip install potrace so the Python fallback works. But do yourself the favor and install the real binary - the README has a full Windows walkthrough: download potrace-1.16.win64-x64.zip from potrace.sourceforge.net, extract to C:\Potrace, add that to your PATH, verify with potrace --version in a new terminal, then restart ComfyUI. On Linux/macOS it's usually sudo apt install potrace or brew install potrace.
Where people get burned
The classic failure is launching it without Potrace anywhere and watching the trace error out - the pure-Python fallback is there, but the binary is the reliable path. Second: a photo or noisy render will trace into a blobby nightmare; downscale, boost contrast, and raise turdsize first. And remember the 1-bit ceiling - if your generated image has gradients, this node is not the way to get those to SVG.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | INT | 1280–255 | — |
| auto_otsu | BOOLEAN | true | — |
| invert | BOOLEAN | false | — |
| turdsize | INT | 20–1000 | — |
| alphamax | FLOAT | 1.000–5 | — |
| opttolerance | FLOAT | 0.200–5 | — |
| turnpolicy | COMBO | minority | 6 options: minority, majority, black, white, left, right |
| fill_rule | COMBO | nonzero | 2 options: nonzero, evenodd |
| backend | COMBO | auto | 3 options: auto, potrace_bin, potrace_py |
| save_svg | BOOLEAN | true | — |
| auto_prefix | BOOLEAN | true | — |
| out_dir | STRING | output/svg | — |
| out_name | STRING | img2svg | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| svg_path | STRING | — |
| svg_text | SVG_TEXT | — |
| preview | IMAGE | — |