Convert ANSI terminal output into a styled terminal screenshot. Produces PNG or SVG with proper colors, bold/dim styling, and optional macOS window chrome.
Pipe any command's output through cli2png. It parses ANSI escape sequences (SGR codes for 24-bit RGB, bold, dim), renders the text with a monospace font, and outputs a screenshot with optional window decoration (title bar with traffic lights). Supports both rasterized PNG (retina-ready at 2x by default) and vector SVG output.
Build from source (requires Xcode and macOS 14+):
make build && make installUSAGE: cli2png [--output <file>] [--width <cols>] [--height <rows>]
[--prompt <text>] [--font-size <px>] [--no-chrome]
[--padding <px>] [--format <fmt>] [--scale <n>]
OPTIONS:
-o, --output <file> Output file (default: stdout, format from extension)
--width <cols> Override column width (default: auto)
--height <rows> Minimum row count (default: auto)
-p, --prompt <text> Add a styled $ prompt line above the output
--font-size <px> Font size in pixels (default: 12)
--no-chrome Skip window chrome, render content only
--padding <px> Content padding (default: 6)
--format <fmt> Output format: png, svg (default: inferred)
--scale <n> Pixel scale for PNG (default: 2)
-h, --help Show help information
# Capture command output as PNG
ls --color=always | cli2png -o listing.png
# SVG output with a prompt
git status | cli2png -p "git status" -o status.svg
# Larger font, no window chrome
cat file.txt | cli2png --font-size 14 --no-chrome -o output.png
# Pipe to stdout
echo "hello" | cli2png > screenshot.pngMIT
