Diagram to SVG/PNG
ai_diagramGenerate flowchart and graph diagrams from concise text or JSON, with automatic layout, and save them as SVG or PNG files.
Instructions
Draw a flowchart / graph diagram from a tiny text language and save it as SVG or PNG, laid out automatically (dagre). One statement per line: direction: LR (TB, LR, BT, RL), title: My flow, A [shape=diamond, label="Ready?", color=#fde68a] (shapes: box, round, diamond, circle, ellipse), edges A -> B: label, chains A -> B -> C, --> dashed, ==> thick, <-> both ends, -- no arrow; quote names with spaces ("Start here" -> A); \n in labels breaks lines; # starts a comment. Or pass JSON { nodes: [{id, label, shape, color}], edges: [{from, to, label, style, arrow}] } as "graph". Up to 500 nodes and 2000 edges. Labels use Helvetica/Arial metrics (Latin text is measured best).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph | No | The diagram as JSON instead of "source". | |
| scale | No | PNG only: pixel density multiplier (2 = twice the SVG size, sharp on high-DPI screens). Default 2. | |
| theme | No | light | |
| format | No | Output format: svg (default) or png. | svg |
| output | No | Where to write the result: a file path, or a folder ending in "/". Default: the server output folder (a temp folder unless --out-dir is set). | |
| source | No | Diagram text in the DSL (or a JSON graph as text). | |
| direction | No | Override the layout direction: TB (top-bottom, default), LR, BT, RL. | |
| returnBase64 | No | Also return the output as base64 in the result (only for small files). Default false. |