Skip to content
Grafex
GitHub

CLI Reference

Complete reference for all CLI commands and flags.

grafex export

Render a composition file to a PNG image.

bash
grafex export -f <file> [options]

Flags

Flag Short Type Default Description
--file -f string Path to the .tsx composition file (required)
--out -o string ./output.png Output file path
--props string (JSON) {} Props to pass to the composition as a JSON object
--width number from config Override composition width in pixels
--height number from config Override composition height in pixels
--format string png Output format (only png currently supported)
--browser string webkit Browser engine to use for rendering
--help -h Show help text

Examples

Basic export:

bash
grafex export -f card.tsx -o card.png

Pass props to a composition:

bash
grafex export -f card.tsx -o card.png --props '{"title":"Hello World","author":"Jane"}'

Override dimensions:

bash
grafex export -f card.tsx -o card.png --width 800 --height 400

Export to a specific directory:

bash
grafex export -f card.tsx -o ./images/card.png

Exit codes

Code Meaning
0 Success — image exported
1 Error — composition failed to render (check stderr for details)

Global Flags

bash
grafex --version    # Print version and exit
grafex --help       # Print help text and exit