ComfyUI Node

SVG Batch Saver

The file output node that keeps its metadata with it

By TJ16th·Created 10 months ago·Updated 10 months ago· 2
SVG Batch Saver
    • svg_path
    • metadata_path
    svg_string
    filename_prefixcenterline
    output_pathoutput/svg
    statistics
    color_info
    save_metadatatrue

    SVG Batch Saver is the pack's second file-output node, and it's the one with a memory. Where SVG File Saver just dumps an SVG to disk, this one will also write a sidecar metadata file - the statistics and color_info JSON strings the pipeline produces - so every exported SVG carries its provenance along. It's the node you want when you're running the full line-art-to-SVG pipeline at scale and need to keep track of what came from where.

    Inputs and outputs

    Required inputs are the same trio as the other saver: svg_string (the SVG), filename_prefix (default centerline), and output_path (default output/svg - relative to ComfyUI's working directory, so your files land under ComfyUI's output tree).

    The differentiator is the optional pair: statistics - feed it the statistics output from Centerline to SVG or SVG Path Cleanup - and color_info, from Line Region Detector. With save_metadata on (the default), both get written to a .json file next to your SVG. Want to know later how many paths a given file started with, or which colors were detected in the source art? It's right there.

    Outputs: svg_path and metadata_path - the actual written file locations as strings, so you can log them or route them somewhere.

    Which saver should you use?

    There are two savers in this pack and they're genuinely different tools:

    • SVG File Saver - has auto_timestamp and overwrite controls. You use it when you want a timestamped, human-managed export file.
    • SVG Batch Saver - no timestamp options, but it wires statistics/color_info into a metadata sidecar. You use it when you're running many generations and want the data that came with each SVG preserved.

    Neither renders anything - they write text. That's the point. For production-quality raster output the README's advice is to save with one of these and render in Inkscape/Illustrator/browser, because the pack's in-graph renderer (SVG To Image) is intentionally basic.

    Install

    The whole pack installs together - there's no separate package for this node:

    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, and the dependencies (numpy, Pillow, opencv, scipy, scikit-image) are the same ones ComfyUI already ships - a bare clone-and-restart typically just works. The one requirement to double-check is opencv-contrib-python, which the pack lists separately.

    Gotchas

    Two things trip people up. First, output_path is relative to ComfyUI's working directory - if you're on a portable install, that's inside the portable folder, and output/svg may not be where you think it is. Second, nothing overwrites: with no overwrite logic in this node, repeated runs with the same prefix and save_metadata on will keep piling up files, which is usually what you want for a batch run but surprising if you expected one file. And remember the meta JSON is only as good as what you fed it - leave statistics empty and you get an empty sidecar, not a crash. If a run "produces nothing," check the returned svg_path string before hunting in folders.

    CategoryTJ_Vector

    Inputs (6)

    NameTypeDefaultDescription
    svg_stringSTRING
    filename_prefixSTRINGcenterline
    output_pathSTRINGoutput/svg
    statisticsoptSTRING
    color_infooptSTRING
    save_metadataoptBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    svg_pathSTRING
    metadata_pathSTRING