Nodes/inkvec-comfyui/Inkvec Trace (raster to SVG)
ComfyUI Node

Inkvec Trace (raster to SVG)

Trace an image to SVG with the Inkvec tracer. Runs the native inkvec binary, which is downloaded from github.com/logolabs/inkvec on first use. Connect LoadImage's MASK to carry transparency.

By logolabs·Created 6 days ago·Updated 4 days ago· 0
Inkvec Trace (raster to SVG)
  • image
  • mask
  • svg
  • preview
  • mask
◄precision0.10►
◄min_area2.0►
◄colors64►
◄merge0.035►
◄max_dim2048►
◄time_budget0.0►
◄margin0.00►
◄cutoutauto►
◄no_backgroundfalse►
◄minifyfalse►
◄lossyauto►
◄harmonizetrue►
◄harmonize_threshold0.92►
◄native_alphatrue►
◄content_unitsfalse►
◄timeout_sec300►
◄extra_args►
CategoryInkvec

Inputs (19)

NameTypeDefaultDescription
imageIMAGE—
precisionFLOAT0.100.01–10Sets the MDL cost of a coordinate: lambda = ln(extent / precision). Smaller keeps more detail with more points. It does not set the digits the emitter writes; output coordinates are fixed at 2 decimals. CLI --precision.
min_areaFLOAT2.00–10000Discard features below this area, in px^2. CLI --min-area.
colorsINT641–4096Maximum palette size. CLI --colors.
mergeFLOAT0.0350–0.5OKLab distance below which two colours are one ink. CLI --merge.
max_dimINT20480–16384Inputs larger than this on their longer side are traced at this size and the SVG is written at the original size. Trace time grows with the pixel count. 0 means no cap. CLI --max-dim.
time_budgetFLOAT0.00–3600Advisory wall-clock budget in seconds. When it runs out the output is still a correct trace, with more fills or a less polished outline. 0 means no budget. CLI --time-budget.
marginFLOAT0.000–0.5Transparent margin around the output, as a fraction of the larger side; the viewBox grows, the geometry does not move. CLI --margin.
cutoutCOMBOautoCarry the input's transparency into the SVG: transparent areas stay holes, a shape drawn at one opacity keeps fill-opacity, and white artwork on a transparent ground survives. auto = on when the image or the mask input has any transparency, off for opaque images. Inkvec 0.1.4 traces transparency natively (native_alpha), which already carries it out, so there this only matters with native_alpha off; on 0.1.3 and older it is what keeps the holes, which is why auto passes it for any transparent image. CLI --cutout.
no_backgroundBOOLEANfalseKnock the background out: the face that covers the whole canvas is not painted, so the artwork sits on transparency. CLI --no-background.
minifyBOOLEANfalseNo ids or groups, no trailing zeros. Same geometry, typically about a tenth smaller. CLI --minify.
lossyCOMBOautoNoise-aware intake for compressed input. The CLI's auto reads the file type, but ComfyUI hands the node decoded pixels (written as PNG), so auto behaves like a PNG here. Set on for JPEG/WebP sources and for images from Inkvec Denoise (inkvec --restore does the same). CLI --lossy.
harmonizeBOOLEANtrueShape harmonization (the CLI default: on). Marks that repeat across the drawing are matched by outline similarity and redrawn from one consensus geometry per cluster, which saves parameters on repetitive art. A mark takes the consensus only where that stays within 0.1 px of the boundary traced for it and costs fewer parameters; a face another face is drawn against, and a fitted circle or rounded rectangle, is never moved. Turn it off to skip the pass. CLI --harmonize.
harmonize_thresholdFLOAT0.920–1Shape-equivalence IoU threshold for harmonization. CLI --harmonize-threshold.
native_alphaBOOLEANtrueTrace transparency natively: each ink carries an opacity and the transparent ground is an ink of its own -- holes stay holes, glows and shadows stay translucent, and white artwork on a transparent ground traces. An opaque image traces the same either way, so leave it on. Off composites onto a matte first, as inkvec releases up to 0.1.3 did. Needs inkvec 0.1.4; an older binary reports --no-native-alpha as an unknown option. CLI --native-alpha.
content_unitsBOOLEANfalseScale the fit tolerances with the raster, so a large, simple drawing gets the parameter count of a small one. Trades fidelity for parsimony: small squares can come back as circles and thin rings broken. Needs inkvec 0.1.4. CLI --content-units.
timeout_secINT3005–7200The node stops the tracer after this many seconds and reports an error.
maskoptMASKTransparency, as LoadImage outputs it (1 = transparent). A mask where 1 marks the subject must be inverted first (InvertMask).
extra_argsoptSTRINGFurther inkvec flags, appended last so they override the widgets, e.g. --strokes or --layers. A flag the installed binary does not know is reported as an error. -o/--output/--help/--version are not allowed.

Outputs (3)

NameTypeDescription
svgSTRINGThe SVG source, one string per image in the batch.
previewIMAGEThe SVG rendered back to pixels (needs resvg-py or cairosvg; otherwise the input image).
maskMASKTransparency of the rendered SVG, 1 = transparent (LoadImage's convention).