Gemini Convert Raster to Vector
Image-to-SVG tracing (no Gemini involved)
- image
- svg_strings
Ignore the "Gemini" in the name - this node doesn't call any AI model and needs no API key. It carries the prefix because it ships in the ComfyUI-OllamaGemini pack. What it does: convert a raster image into an SVG by tracing it, using vtracer (the node's own description says so, "for best quality"). It's how you turn a generated pixel image into scalable vector paths without leaving ComfyUI.
It's essentially the same node as the pack's Raster to Vector (SVG) (ConvertRasterToVector), with one addition: an optimize toggle. Same tracing engine, same knobs, one extra switch.
Why you'd reach for it
Vectors are what you want for logos, icons, and flat art you'll scale or recolor. Open-source diffusion models all output pixels - the only image generator that produces vectors natively is the closed, paid Recraft V3 (per the knowledge base). So in an open workflow, tracing is the route to SVG: generate the art, then convert it here.
How it works
vtracer clusters regions of similar color and fits paths around them. It has no semantic understanding of the picture, which is exactly why it shines on flat, limited-color art and falls apart on photos - trace a photorealistic render and you get thousands of paths and a huge file. Feed it clean, bold, few-color graphics and it's excellent.
The inputs that matter
The ones worth setting:
colormode-colorfor full color,binaryfor a single-color silhouette.mode-splinefor smooth curves (default),polygonfor hard straight edges.filter_speckle(default 4) - removes clusters below this pixel size; the go-to dial for killing noise.color_precision(default 8) - number of color levels kept; lower it to posterize and shrink the file.optimize(default on) - this node's extra toggle, which cleans up and simplifies the output SVG. Leave it on unless you're debugging path output.
The remaining dials (corner_threshold, length_threshold, max_iterations, splice_threshold, path_precision) fine-tune curve smoothing and joining; the defaults are good.
The output is svg_strings, a LIST of SVG text - not a viewable image. Pass it to the pack's Gemini Save SVG node to write the .svg and get a rendered preview.
Installing it
Install the ComfyUI-OllamaGemini pack via ComfyUI Manager (search the name, install, restart) or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
pip install -r requirements.txt
then restart. It depends on the vtracer Python package from requirements.txt; if the node throws an import error at run time, that dependency didn't install - re-run the pip install in the pack folder.
Where people get burned
Don't trace photos. Vectorization is for flat graphics; on a photorealistic image it produces a massive, path-heavy file that looks worse than the source. Generate art meant to be flat - strong shapes, limited palette - or posterize first.
Also remember this node emits SVG strings, so nothing appears until you route them through Gemini Save SVG. When edges come out ragged, raise filter_speckle and lower color_precision before touching the threshold dials. And since this is the twin of Raster to Vector (SVG) with only the optimize switch added, there's no reason to run both - pick this one if you want that extra optimization pass, the other if you don't.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| colormode | COMBO | color | 2 options: color, binary |
| mode | COMBO | spline | 2 options: spline, polygon |
| filter_speckle | INT | 40–20 | — |
| color_precision | INT | 81–16 | — |
| corner_threshold | INT | 800–180 | — |
| length_threshold | FLOAT | 2.000.5–10 | — |
| max_iterations | INT | 151–50 | — |
| splice_threshold | INT | 450–180 | — |
| path_precision | INT | 51–10 | — |
| optimize | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| svg_strings | LIST | — |