ComfyUI Node

AIraster

The node that quietly puts a real SVG on your disk

By AARG-FAN·Created 2 years ago·Updated 2 years ago· 159
AIraster
  • image
  • vector_image
colormodecolor
hierarchicalstacked
modespline
filter_speckle4
color_precision6
layer_difference16
corner_threshold60
length_threshold4.0
max_iterations10
splice_threshold45
path_precision8
output_directory

The name is a lie, but in a good way. AIraster does the opposite of what it says: it takes a raster (pixel) image from your ComfyUI graph and writes a genuine SVG vector file to disk. It's a one-node pack that wraps vtracer, the same Rust-based tracer behind online raster-to-vector tools, and it exists for people who don't want a PNG at the end of a workflow - they want a logo, a sticker outline, a cut file for a vinyl plotter, or a clean vector for print. If you've ever generated something with SD or Flux and then traced it by hand in Inkscape, this is the shortcut.

How it works

The node is a thin pipeline of three steps, and you can read all of it in the source since the pack is a single file. Your IMAGE tensor becomes a PIL image, gets saved to a temporary PNG, and is handed to vtracer.convert_image_to_svg_py(), which writes an .svg file. Then - the part people miss - it uses Wand (the Python binding for ImageMagick) to render that SVG back into a PNG and returns that as the node's output.

So the actual deliverable is the .svg file on your disk. The vector_image output you wire into your graph is just a preview of what the SVG looks like once rendered. It's useful for checking your settings without opening a file browser, but it's not the thing you keep.

The inputs that matter

Most of the twelve inputs are vtracer's curve-fitting knobs, and the defaults are genuinely fine to leave alone. The ones a beginner actually touches:

  • image - the required input; feed any IMAGE from a Load Image, a VAE Decode, or an upscale path.
  • mode (spline / polygon / none) - how paths are traced. spline gives smooth Bézier curves, the right default for logos and organic shapes; polygon forces straight edges, handy for architectural or geometric art.
  • colormode - color or binary. Pick binary when you want a clean two-tone (foreground/background) trace; this is your posterize-into-a-sticker switch.
  • filter_speckle - drops tiny noise flecks before tracing; raise it if your output looks like it's covered in pimples.
  • color_precision - bits per channel for color quantization. Lower = flatter, fewer colors; higher = more detail, messier paths.
  • output_directory - the one that decides whether you ever find the file. See below.

Installing it

ComfyUI Manager can find it by searching "Image-Vector-for-ComfyUI" (the pack's display title). Manual install is the usual dance:

cd ComfyUI/custom_nodes
git clone https://github.com/AARG-FAN/Image-Raster-for-ComfyUI
cd Image-Raster-for-ComfyUI
pip install -r requirements.txt

then restart ComfyUI. If you're on the Windows portable build, the README helpfully notes you need to run the install with python_embeded\python.exe -m pip install -r requirements.txt instead.

The dependency you can't pip-fix: Wand needs the ImageMagick system binary. The README links the Windows installer directly and points at the wand install docs. On Linux that's sudo apt install imagemagick (or your distro's equivalent); on macOS, brew install imagemagick. Skip this and the node fails silently - see below.

Where people get burned

  • The SVG vanishes. If you leave output_directory empty, the node writes the SVG into your OS temp folder (tempfile.gettempdir()) under a random name, because the base filename comes from a temporary file it created. The README's advice is blunt: paste the folder you want into output_directory, run, and the file appears there. You can't set the output filename - it'll always be the temp name.
  • Silent failure. The whole pipeline is wrapped in a try/except that returns None on any error. If ImageMagick isn't installed, you don't get a friendly traceback - you get a node that looks fine and a downstream error out of nowhere.
  • No batches. The code does image.squeeze(0), which only removes the batch axis when it's size 1. Feed it a batch of two and a 4D array goes straight to PIL, which throws - another silent None. Feed one image at a time.
  • The preview lies a little. Re-rendering through ImageMagick happens at the SVG's default resolution, so the PNG output won't be a 1:1 copy of your input. Don't judge detail from the preview; open the SVG.

Honest caveat: this is a tiny, lightly maintained pack - essentially a vtracer demo with ComfyUI's example-node scaffolding still in the docstrings. It does one thing and does it fine. If you outgrow it (multi-color tracing, sharper output, proper SVG saving), the community-standard alternatives are ComfyUI-ToSVG and the Potracer node, used for exactly this vinyl/logos workflow. But for "turn this image into an SVG file," AIraster is the fewest moving parts you'll find.

CategoryVectorization

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
colormodeCOMBOcolor2 options: color, binary
hierarchicalCOMBOstacked2 options: stacked, cutout
modeCOMBOspline3 options: spline, polygon, none
filter_speckleINT41–128
color_precisionINT61–10
layer_differenceINT161–20
corner_thresholdINT601–100
length_thresholdFLOAT4.03.5–10
max_iterationsINT101–20
splice_thresholdINT451–100
path_precisionINT81–10
output_directorySTRING

Outputs (1)

NameTypeDescription
vector_imageIMAGE