ComfyUI Node

SVG File Saver

The node that gets your vector out of ComfyUI and into the real world

By TJ16th·Created 10 months ago·Updated 10 months ago· 2
SVG File Saver
    • file_path
    svg_string
    filename_prefixcenterline
    output_pathoutput/svg
    auto_timestamptrue
    overwritefalse

    Every other node in this pack produces an SVG string - a blob of text that only exists inside your graph. SVG File Saver is the exit door: it writes that string to an actual .svg file on disk, which is the moment your vectorized line art becomes something a laser cutter, a plotter, Inkscape, or Illustrator can actually open. If you want a real, shareable, editable vector file at the end of your workflow, this is the node.

    Inputs

    Three required, all simple:

    • svg_string - the SVG from Centerline to SVG or any editor node.
    • filename_prefix - the base name, default centerline.
    • output_path - where to write, default output/svg (relative to ComfyUI's working directory, so it lands under ComfyUI's output tree).

    Two optional toggles give you control over the collision case:

    • auto_timestamp (default on) - appends a timestamp to the filename so repeated runs don't stomp each other.
    • overwrite (default off) - when on, deliberately replaces an existing file with the same name.

    Output: file_path, a STRING with the absolute path to what you just wrote. Wire it to a text/display node if you want to see where the file went - or just log it in the console.

    Why save files at all when there's SVG To Image?

    Because SVG To Image is deliberately basic. It renders simple paths with Pillow so you can preview and recycle inside the graph, but it won't do gradients, filters, or fancy path syntax - and it's not what you'd engrave anything from. The README's stated workflow for high-quality output is: save with this node, then render in Inkscape / Illustrator / your browser. A saved .svg is also infinitely editable downstream - you can open it, recolor it, ungroup it, and nobody will ever know it started life in a diffusion model. This node is how "line art → vector" stops being a party trick and becomes a deliverable.

    Install

    It's part of the pack - there's no standalone install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TJ16th/TJ_ComfyUI_Lineart2Vector.git
    # restart ComfyUI
    

    or ComfyUI Manager → search TJ_ComfyUI_Lineart2Vector. No model downloads, no API keys. The requirements.txt list (numpy, Pillow, opencv-python, opencv-contrib-python, scikit-image, scipy, torch) is nearly all stock ComfyUI, so a bare clone usually just works.

    Where people get burned

    • "Where did my file go?" - output/svg is relative to the ComfyUI working directory, and on portable installs that's inside the portable folder, not your desktop. Read the file_path output - it's the source of truth.
    • Silent overwrite surprises - with auto_timestamp on, you'll get a pile of centerline_<timestamp>.svg files, which is fine for batching but confusing if you expected one file. Turn it off and set overwrite on when you want a stable filename.
    • Writing an empty SVG - the saver is a dumb writer: if the svg_string input is empty or the upstream node produced garbage, you get an empty file and no error. Check svg_string is actually populated (SVG To Image or SVG Group Layout are good spot-checkers) before you blame the saver.

    For production, the flow that works: vectorize → clean up paths → style → auto-reorder with renumbering so your layers are predictable → save here. Then open the result in a real editor and marvel that it's not a PNG anymore.

    CategoryTJ_Vector

    Inputs (5)

    NameTypeDefaultDescription
    svg_stringSTRING
    filename_prefixSTRINGcenterline
    output_pathSTRINGoutput/svg
    auto_timestampoptBOOLEANtrue
    overwriteoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    file_pathSTRING