Nodes/ComfyUI-ToSVG/SVG String to SVG BytesIO
ComfyUI Node

SVG String to SVG BytesIO

Wrap an SVG string into the core SVG type for ComfyUI's own nodes

By Yanick112·Created 2 years ago·Updated about a year ago· 314
SVG String to SVG BytesIO
    • SVG
    ◄SVG_String—►

    TS_SVGStringToSVGBytesIO is the other half of the bridge pair the pack added in its June 17 update. Where TS_SVGBytesIOToString unwraps a core SVG object into a plain string, this node wraps a plain string into the core SVG object type - a list of in-memory byte buffers - so it can feed ComfyUI's own SVG-aware nodes.

    One input, one output: SVG_String in, type SVG out. Under the hood it encodes the string to UTF-8, stuffs it into a BytesIO, and returns it wrapped in the core SVG container. That's the entire mechanism, and it's worth understanding because that SVG type is exactly what ComfyUI core's built-in Save SVG node consumes.

    The actual use case

    This is the node you reach for when you want the core ComfyUI Save SVG node (or any node that speaks the SVG object type) to be your saver, instead of the pack's own TS_SaveSVGString. The pack's converters all output plain strings; core's save node wants the wrapped form. So:

    image → TS_ImageToSVGStringBW_Vtracer → this node → core Save SVG node.

    The practical difference between the two save paths is minor - both write real .svg text files - so which one you use is mostly taste. If you already have core's Save SVG node in your template, this adapter lets you route this pack's output into it without a file round-trip in between.

    Install

    Same pack, same install. ComfyUI Manager → search ComfyUI-ToSVG → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Yanick112/ComfyUI-ToSVG/
    cd ComfyUI-ToSVG
    pip install -r requirements.txt
    

    Dependencies: vtracer, numpy, Pillow, torch, PyMuPDF, potracer. No models, no API keys, CPU-only. It sits under 💎TOSVG/Tools with the other utilities, and it does zero tracing - it's pure type plumbing, which makes it the smallest node in the pack and exactly as useful as the day you actually need it.

    Category💎TOSVG/Tools

    Inputs (1)

    NameTypeDefaultDescription
    SVG_StringSTRING—

    Outputs (1)

    NameTypeDescription
    SVGSVG—