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

SVG BytesIO to SVG String

Unwrap an SVG object back into plain text

By Yanick112·Created 2 years ago·Updated about a year ago· 313
SVG BytesIO to SVG String
  • SVG_BytesIO
  • STRING

TS_SVGBytesIOToString is a bridge node, added in the June 17 update, and it's about type compatibility - which is the most boring but most necessary thing in ComfyUI. The pack's converters hand you SVG as plain strings. But ComfyUI core has its own SVG object type - a list of in-memory byte buffers (BytesIO objects) that core nodes like the built-in Save SVG node work with. When one of those hands you an SVG object and the string-based nodes in this pack want text, this node is the adapter.

One input, one output: SVG_BytesIO (type SVG) in, STRING out. Under the hood it reads the first buffer from the object's data, decodes it from UTF-8, and hands you the markup as a plain string. An empty object returns an empty string rather than erroring.

When you'll actually use it

  • A core or third-party node upstream gives you an SVG object, and you want to feed it into TS_SVGPathSimplify, preview it with TS_SVGStringPreview, or save it with TS_SaveSVGString - all of which want a string.
  • You're moving SVG data between this pack and the core SVG ecosystem and need both directions covered. (The reverse direction is TS_SVGStringToSVGBytesIO.)

That's the whole job. It's a utility, not a headline feature - but the first time a workflow hands you an opaque SVG object and you need the text, this node saves you from writing a file, reading it back, or grepping bytes by hand.

Install

Same pack, same install as everything in ComfyUI-ToSVG. 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 model downloads, no API keys, CPU-only - this one doesn't even trace anything, it just re-types bytes. It lives under 💎TOSVG/Tools.

Category💎TOSVG/Tools

Inputs (1)

NameTypeDefaultDescription
SVG_BytesIOSVG—

Outputs (1)

NameTypeDescription
STRINGSTRING—