SVG to Image
Turn an LLM's SVG drawing into a real image
- img
LLMs can write SVG markup - simple diagrams, icons, basic vector shapes - as plain text. svg2img_function is what turns that text into something the rest of ComfyUI can actually use: a rasterized IMAGE tensor, rendered at whatever pixel size you ask for. Once it's an IMAGE, it's just another image in your graph - save it, upscale it, composite it with generated art, whatever the workflow calls for.
This is the sibling of svg2html in the same pack: same starting point (LLM-written SVG), two different destinations. svg2html wraps it for a webpage or published document; svg2img_function renders it into a pixel image for a ComfyUI pipeline. Which one you want depends entirely on where the result needs to go next.
Inputs and outputs that matter
svg_str- the raw SVG markup, generally straight from an LLM node's response.width/height- the render canvas size, defaulting to800×600. This is the pixel size of the output image, not necessarily the SVG's own internal coordinate system - if the SVG'sviewBoxdoesn't match this aspect ratio, expect scaling or cropping.is_enable- the pack's standard skip switch.
Single output: img, a normal IMAGE.
Installing it
Search comfyui_LLM_party in ComfyUI Manager and install, or clone directly:
cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party
pip install -r requirements.txt inside your ComfyUI Python environment, then restart. This node needs no LLM API access itself, but it ships inside the full pack, which is a heavier install overall - LLM clients, local model loading, RAG, TTS, and a long list of other tool nodes come along with it. If you only need the API-calling side, the README's only_api branch is lighter.
Common issues
The reliability of the output tracks directly with how simple the SVG is. Basic shapes and paths render predictably; gradients, filters, embedded or referenced fonts, and other more advanced SVG features are far more likely to render differently - or not at all - depending on what's actually doing the rasterizing under the hood. If your LLM-generated diagrams keep coming out wrong or blank, simplify the prompt asking for the SVG rather than assuming the node is broken: nudge the model toward plain shapes and explicit fills instead of anything relying on filters or gradients.
Also watch the aspect ratio mismatch trap: if you set width/height to something that doesn't match the SVG's own proportions, you'll get stretching or unexpected empty space rather than an error - there's no built-in "fit" behavior implied by the schema, so if a specific composition matters, either match the canvas size to the SVG's own dimensions or crop/resize after the fact with a normal ComfyUI image node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| svg_str | STRING | — | |
| width | INT | 800 | — |
| height | INT | 600 | — |
| is_enable | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| img | IMAGE | — |