export
Render a Figma node from a saved .fig file to SVG, PNG, JPG, WebP or AVIF, using scale, quality and size limits to produce website assets or inline images.
Instructions
Export a node to SVG, PNG, JPG, WebP or AVIF. Create the output directory first. Returns metadata and, for raster formats, an inline image. PNG suits inline references: up to 4,194,304 pixels it is losslessly optimized with exact decoded RGBA, keeping original encoded bytes unless smaller; larger PNGs keep regular encoding. For website assets, follow the target project's existing image pipeline; otherwise start with WebP for bitmaps, sized for display dimensions and DPR using scale/maxSize and quality/maxKb. SVG embeds original images and can be large; keep it for vector artwork. When inlining or optimizing SVG, keep its root transform and unique ids (SVGO: prefixIds, not cleanupIds). The export covers what the node draws; bounds: layout exports the layout box, and warnings report when the two differ, any known skipped or approximated rendering in the subtree, as bundle warnings do, and images or components the file lacks. scale, quality and maxSize affect raster formats only; maxSize defaults to 1600. Check returned dimensions/bytes and isError; read content on failure.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file": "<file>",
"node": "<node>",
"out": "<out>"
},
"name": "export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| out | Yes | output path ending in .png, .jpg, .jpeg, .webp, .avif or .svg; shipped assets follow the project's asset conventions, reference and scratch files go in .figlens/exports/ under the project root, created with a .gitignore containing * so it stays out of Git; create the parent directory first | |
| file | Yes | the saved .fig: a local path (absolute recommended), or gs://bucket/object using gcloud; remote sources are unavailable with --root | |
| hide | No | comma-separated ids of layers inside node to draw as hidden, over the same area (reply lists hidden); compare with the plain export to see where that layer, as figlens draws it, changes the result; no difference does not prove its skipped rendering harmless (it may match what is beneath it) | |
| node | Yes | a stored node id (12:345 or 12-345), full instance sublayer id (I12:345;67:89) from inspect/nodes, or a Figma URL with ?node-id= | |
| maxKb | No | KiB (1024 bytes) budget; lower lossy quality until it fits; PNG/SVG fail if over budget | |
| scale | No | default 1 | |
| bounds | No | render (default): what the node draws, shadows, outside strokes and overflowing children included, as Figma's Export panel; layout: the node's own box (absoluteBoundingBox), cutting off what is drawn past it | render |
| maxSize | No | longest side in pixels, default 1600; 0 keeps the scaled size | |
| quality | No | 1-100, default 80 | |
| matchDir | No | SVG output only: a folder of SVG files, subfolders included, to compare with the export, to find an icon the project already has; matches lists the files (relative paths) that draw the same outlines once both are moved to the origin, ignoring paint, ids and path syntax; similar lists up to 10 others with a similar shape (drawn with strokes, or the same outlines at another size, which score 1) as {file, score} from 0.8, best first; confirm a similar file by looking at both |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| bytes | Yes | ||
| width | Yes | ||
| height | Yes | ||
| hidden | No | with hide: the layers drawn as hidden | |
| matches | No | with matchDir: files there (relative paths) that draw the same outlines | |
| quality | Yes | the quality used; --max-kb may lower it | |
| similar | No | with matchDir: up to 10 other files with a similar shape as {file, score}, score 0.8-1, best first; not proof of the same icon | |
| warnings | No | first, when the drawn area differs from the layout box, how far it reaches past each side, what draws there when known, and which box was exported; then one `Render <state> at node <id> (<field>): <reason>` line per background blur this render left out at its blur limit and per known skipped or approximated rendering in the subtree, as in bundle warnings; then one line per visible image paint whose bytes the file lacks (`Image <ref> at node <id> is not in the .fig; it is drawn empty`) and per instance whose component it lacks (`Component <id> of instance <id> is not in the .fig; ...`), as in a .fig from `figlens clipboard`; empty when none applies | |
| layoutBox | No | absoluteBoundingBox in page coordinates | |
| renderBox | No | absoluteRenderBounds in page coordinates |