Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/open-pencil/open-pencil/llms.txt

Use this file to discover all available pages before exploring further.

Export a .fig file to an image. Supports PNG, JPG, and WEBP formats with configurable scale and quality.

Usage

bunx @open-pencil/cli export <file> [options]

Arguments

ArgumentDescription
filePath to .fig file (required)

Options

OptionAliasDescription
--output-oOutput file path (default: <name>.<format>)
--format-fExport format: png, jpg, webp (default: png)
--scale-sExport scale (default: 1)
--quality-qQuality 0-100 for JPG/WEBP (default: 90)
--pagePage name (default: first page)
--nodeNode ID to export (default: all top-level nodes)
--thumbnailExport page thumbnail instead of full render
--widthThumbnail width (default: 1920)
--heightThumbnail height (default: 1080)

Examples

Basic export (PNG)

bunx @open-pencil/cli export design.fig
Outputs design.png at 1x scale.

JPG at 2x scale

bunx @open-pencil/cli export design.fig -f jpg -s 2
Outputs design.jpg at 2x scale with 90% quality.

WEBP with custom quality

bunx @open-pencil/cli export design.fig -f webp -q 80

Custom output path

bunx @open-pencil/cli export design.fig -o screenshots/homepage.png

Export specific page

bunx @open-pencil/cli export design.fig --page Components

Export single node

bunx @open-pencil/cli export design.fig --node "1:23" -o button.png
Exports only the node with ID 1:23.

Page thumbnail

bunx @open-pencil/cli export design.fig --thumbnail --width 1280 --height 720
Generates a thumbnail of the entire page at the specified dimensions.

Formats

FormatExtensionQualityUse Case
PNG.pngLosslessScreenshots, design handoff, transparency
JPG.jpgLossyPreviews, thumbnails, no transparency
WEBP.webpLossySmaller file size, modern browsers

Scale

The --scale option multiplies the output dimensions:
  • 1 — 1x (default, same as Figma canvas)
  • 2 — 2x (Retina/HiDPI)
  • 3 — 3x (high-resolution prints)
  • 0.5 — half size (quick previews)
Example:
# Node is 100x100 in Figma
bunx @open-pencil/cli export design.fig -s 2  # outputs 200x200 PNG

Quality

For JPG and WEBP, --quality controls compression (0-100):
  • 90 — default (high quality, reasonable file size)
  • 100 — maximum quality (largest file size)
  • 80 — good balance for web use
  • 60 — smaller files, visible artifacts
PNG ignores the --quality option (always lossless).

Rendering

  • Uses Skia (CanvasKit WASM) for pixel-perfect rendering
  • Fonts — loads local fonts via Bun’s file system access
  • Effects — renders shadows, blurs, blend modes
  • Auto-layout — computes Yoga layout before rendering
  • Viewport culling — off-screen nodes are still rendered (no culling during export)

Thumbnail Mode

The --thumbnail flag renders the entire page scaled to fit the specified dimensions:
bunx @open-pencil/cli export design.fig --thumbnail --width 1920 --height 1080
  • Fits the entire page (all top-level nodes) into the bounding box
  • Maintains aspect ratio
  • Useful for page previews, OG images, design documentation

Error Handling

The command will exit with an error if:
  • Invalid format (not png/jpg/webp)
  • Page not found (--page doesn’t match any page name)
  • Node not found (--node ID doesn’t exist)
  • Empty page (no visible nodes to render)

Use Cases

  • Generate thumbnails for design file browsers
  • CI/CD visual regression testing
  • Automated design documentation
  • OG images for marketing pages
  • Design handoff (export artboards at 2x)
  • Print assets (export at 3x or higher)