| name | freeze |
| description | Use when generating an image (SVG, PNG, or WebP) of source code or terminal output — for READMEs, slides, docs, social posts, or screenshots of a code snippet or command output — using the charmbracelet/freeze CLI. Triggers on "freeze", "screenshot this code", "image of code", "render terminal output as image", "code snippet picture". |
freeze — images of code and terminal output
Overview
freeze (charmbracelet) renders source code or captured terminal output to an
image. Two input modes, three output formats. The output format is chosen by the
file extension of -o (.svg, .png, .webp). With no -o, it writes
freeze.png in the current directory.
Verify it's installed: freeze --version (this skill written against v0.2.2).
Install: go install github.com/charmbracelet/freeze@latest or brew install freeze.
Two input modes
freeze main.go -o code.svg
freeze --execute "ls -la" -o out.svg
freeze -x "git diff --color" -o diff.png
Also reads stdin (give -l/--language since there's no filename), and reads
a file that already contains ANSI escapes to reproduce colored terminal output:
echo 'print("hi")' | freeze --language python -o snippet.svg
ls --color=always > out.txt && freeze out.txt -o out.svg
Quick reference
| Flag | Purpose |
|---|
-o --output | Output path; extension picks format (.svg/.png/.webp). Default freeze.png. |
-x --execute | Capture a command's output instead of reading a file. |
-l --language | Force syntax language (needed for stdin). |
-t --theme | Syntax theme (chroma themes, e.g. dracula, nord, github, catppuccin-mocha). Default charm. |
-c --config | Built-in preset (base, full, user) or path to a .json/.yaml config. |
-w --wrap | Wrap lines at a given width. |
--lines | Capture a line range, e.g. --lines 5,20. |
--show-line-numbers | Render line numbers. |
-i --interactive | Interactive form to pick options. |
Styling: -b --background (fill), -m --margin, -p --padding,
--window (macOS-style traffic-light controls), -W --width, -H --height,
--font.family, --font.size, --font.ligatures, --line-height.
Borders: -r --border.radius, --border.width, --border.color.
Shadow: --shadow.blur, --shadow.x, --shadow.y.
Run freeze --help for the complete list.
Margin & padding syntax
CSS-style — one value (all sides) or comma-separated:
freeze main.go -p 20
freeze main.go -p 20,40
freeze main.go -m 20,40,60,80
Common recipes
freeze main.go -t dracula --window -p 20,40 -r 8 --shadow.blur 20 -o snippet.png
freeze server.go --lines 10,30 --show-line-numbers -o slice.svg
freeze -x "neofetch" -W 1200 -o term.png
freeze -c full main.go -t nord -o code.svg
Notes & gotchas
- Extension is the format selector.
-o code.svg → SVG; -o code.png → PNG. There is no separate --format flag.
- SVG is sharpest and smallest for code; use PNG/WebP when the target (e.g. GitHub READMEs, chat) won't render SVG fonts reliably.
--execute runs the command in a shell and captures its rendered output (ANSI colors included) — quote the whole command.
- For reproducible styling across many images, put options in a JSON/YAML config and pass it with
-c path.json instead of repeating flags.
- PNG/WebP rendering rasterizes at a default scale; bump
-W/-H or --font.size if output looks small.