Export a PNG screenshot of the specified frame from a Figma URL.
When to Use
- When you need to obtain a static screenshot of a Figma design
- Before comparing the design vs the implementation
Prerequisites
- Environment variable
FIGMA_ACCESS_TOKENmust be set - Install
requests:pip install requests
Usage
python scripts/figma-export.py "<figma_url>" --output design.png [--scale 2] [--node-id <id>]
Parameters
| Parameter | Required | Description |
|---|---|---|
figma_url |
Yes | URL of the Figma file or frame |
--output |
No | Output filename (default figma-export.png) |
--scale |
No | Scale factor (default 2, i.e. 2x resolution) |
--node-id |
No | Specify node ID (obtained from the URL's node-id= parameter) |
Figma URL Format
The following formats are supported:
https://www.figma.com/file/XXXXX/FileName?node-id=1-2https://www.figma.com/design/XXXXX/FileName?node-id=1-2
Alternatives
If there is no Figma Token:
- Ask the user to manually export a screenshot from Figma
- Or use Playwright to open the Figma URL and take a screenshot (the user must already be logged in to Figma)