Generate beautiful screenshots of code snippets from the command line.
PNG, SVG, or ANSI terminal output — syntax highlighting, line numbers, and colored annotations, no browser required.
- Syntax highlighting for 200+ languages via Shiki (VS Code-quality tokenization)
- Line numbers with proper gutter alignment
- Red/green highlights — full lines or precise column ranges
- Multiple ranges —
--lines 10-14,42-56captures several sections, folding the gaps automatically - Fold/collapse line ranges to hide boilerplate with
--fold - Context lines — 3 lines around your selection by default (
--context/--no-context) - Page-fit guard — errors past 70 rendered rows so snippets fit on a page (
--max-lines/--no-max-lines) - Page-width word wrap — long lines wrap to fit a document by default (
--max-width/--no-max-width) - Automatic language detection from 150+ file extensions, with graceful plaintext fallback for unknown types
- Dark & light themes — One Dark Pro (default) or One Light via
--theme - SVG output — same layout as a crisp, scalable vector file via
--svg - Terminal output — print the snippet as ANSI-colored text (24-bit color) via
--ansi - IntelliJ plugin — right-click a selection in any JetBrains IDE (PLUGIN.md)
- VS Code extension — the same, in VS Code (VSCODE.md)
- Offline — everything runs locally, no network needed
- Standalone binaries for Linux, Windows, and macOS (via Bun compile), built and attached to Releases automatically
# npm (requires Node.js >= 18)
npm install -g snipshot
# or run directly
npx snipshot <file> --lines <ranges>snipshot <file> --lines <ranges> [options]| Option | Description |
|---|---|
--lines <ranges> |
Line range(s) to capture, e.g. 42-56 or 10-14,42-56 (gaps between ranges are folded) (required) |
--highlight-red <specs> |
Red highlights — comma-separated and/or repeatable |
--highlight-green <specs> |
Green highlights — comma-separated and/or repeatable |
--fold <ranges> |
Collapse line ranges into a single indicator row — comma-separated and/or repeatable |
--context <n> |
Lines of context before/after --lines, clamped to the file (default: 3) |
--no-context |
Show exactly the requested lines |
--max-lines <n> |
Error if the result exceeds this many rows so it fits a page (default: 70) |
--no-max-lines |
Disable the rows limit |
--theme <name> |
Color theme: dark (default) or light |
--max-width <pixels> |
Max image width with word wrap (default: 800 ≈ a page width) |
--no-max-width |
Disable word wrap (image grows to the longest line) |
--svg |
Write an SVG document instead of a PNG (default name: <name>_L<start>-<end>.svg) |
--ansi |
Print the snippet to stdout as ANSI-colored text (24-bit color) instead of writing a file; with --output, saves the colored text there |
--output <path> |
Output file path (default: <name>_L<start>-<end>.png or .svg) |
--root <path> |
Project root for the header path (default: nearest .git above the file, else the current directory) |
Running snipshot with no arguments prints this help.
Each --highlight-* and --fold flag takes one or more comma-separated targets (and can be repeated):
47 # entire line 47
47-50 # lines 47 through 50
47:12-38 # line 47, columns 12 to 38 (highlights only — draws a box)
13,15-18 # several at once in a single flag
All numbers are 1-based and inclusive.
# Basic screenshot (3 context lines added automatically)
snipshot src/App.java --lines 42-56
# Multiple highlights in one flag
snipshot src/App.java --lines 42-56 --highlight-red 47,50-52 --highlight-green 55:12-38
# Several line ranges at once — the gaps between them are folded automatically
snipshot src/App.java --lines 10-14,42-56,80-95
# Wider lines (override the default page-width wrap), or disable wrapping
snipshot src/App.java --lines 1-20 --max-width 1100
snipshot src/App.java --lines 1-20 --no-max-width
# Fold boilerplate to focus on what matters
snipshot src/App.java --lines 1-80 --fold 5-30,60-70
# Exactly the requested lines, no context
snipshot src/App.java --lines 42-56 --no-context
# Large extract that exceeds the 70-row page-fit limit
snipshot src/App.java --lines 1-200 --no-max-lines
# Light theme
snipshot src/App.java --lines 42-56 --theme light
# Custom output path
snipshot src/App.java --lines 42-56 --output screenshot.png
# SVG instead of PNG (scalable, small file)
snipshot src/App.java --lines 42-56 --svg
# ANSI-colored output straight to the terminal
snipshot src/App.java --lines 42-56 --highlight-red 47 --ansiTypeScript with interface highlight and column annotation:
Long lines wrapped to a fixed width, with mixed highlights:
Clean output without highlights:
Same layout as the PNG, but scalable and a fraction of the size — these two are real .svg files rendered by your browser. They render the same in Word, PowerPoint and IntelliJ: the SVG sticks to the subset those engines honour (hex colors with fill-opacity rather than rgba(), explicit baselines and positions).
Several ranges at once (--lines 3-5,39-42,84-91) — the gaps are folded automatically:
Light theme with red/green annotations:
Printed straight to stdout in 24-bit color — same header, gutter, folds and highlights, no file written:
Syntax highlighting:
Red/green annotations:
Folded region:
Pre-built binaries include the Bun runtime — no Node.js installation needed on the target machine.
Grab the archive for your platform from Releases (.tar.gz for Linux/macOS, .zip for Windows), extract it, and run:
tar xzf snipshot-linux-x64.tar.gz
./snipshot src/App.java --lines 10-30Releases are built automatically by GitHub Actions: pushing a v* tag runs the tests, cross-compiles all four platform binaries, and attaches the archives to a GitHub Release.
Requires Bun:
# All platforms (linux, win, mac-intel, mac-arm)
npm run build:standalone
# Specific platform
npm run build:standalone:linux
npm run build:standalone:win
npm run build:standalone:mac-intel
npm run build:standalone:mac-arm
npm run build:standalone:mac # both macOS arches
# Or call the script directly (also supports comma-separated platforms)
node scripts/build-standalone.mjs linux,winEach platform builds to its own folder — standalone/<os>/snipshot (or snipshot.exe on Windows):
standalone/
├── linux/snipshot
├── win/snipshot.exe
├── mac-intel/snipshot
└── mac-arm/snipshot
Every binary is a single self-contained file.
Install system-wide (Linux/macOS):
sudo cp standalone/linux/snipshot /opt/snipshot
sudo ln -s /opt/snipshot /usr/local/bin/snipshotRight-click a selection in the editor and get the same image the CLI produces — on the clipboard by default, or as a PNG or SVG file. Full documentation → PLUGIN.md
- Snipshot this (red) / (green) shoots the visible window with your selection outlined in it — the annotation keeps its context instead of being cropped to it.
- Mark Selection Red / Green / Folded tints regions in the editor, then one shot carries them all.
- Multi-caret selections become several ranges in one image, gaps folded.
- Destination is configurable: clipboard, a save dialog that remembers the last
folder,
.snipshot/in the project, the project root, or a fixed directory.
Install snipshot-intellij-plugin.zip from Releases through
Settings | Plugins | ⚙ | Install Plugin from Disk… — it works on IntelliJ 2024.1
and newer, in any JetBrains IDE. Its settings page can download the CLI binary for
you. To build it from source:
npm run build:plugin # -> standalone/intellij/snipshot-intellij-plugin.zipBuilding it needs a JDK 17 or newer; Gradle and the compile toolchain come from
the committed wrapper. Development notes live in
extra/intelij/snipshot-plugin.
The same thing for VS Code: the same Snipshot submenu on right-click, the same actions, marks, destinations and settings, wrapping the same CLI. Full documentation → VSCODE.md
Install snipshot-vscode-extension.vsix from Releases through
Extensions | … | Install from VSIX… (or code --install-extension <file>); it
works on VS Code 1.85 and newer. Snipshot: Download Binary fetches the CLI for
you. To build it from source:
npm run build:vscode # -> standalone/vscode/snipshot-vscode-extension.vsixBuilding it needs Node 22 or newer and nothing else. Development notes live in
extra/vscode/snipshot-vscode.
- Reads the full source file (not just the requested lines) to ensure accurate syntax highlighting
- Tokenizes with Shiki using the One Dark Pro theme (or One Light with
--theme light) - Renders to a canvas with @napi-rs/canvas (Skia-based, no browser needed)
- Exports as PNG — or, from the same layout engine, as an SVG document (
--svg) or ANSI-colored terminal text (--ansi)
The font used is JetBrains Mono (bundled).
git clone https://github.com/9pings/snipshot.git
cd snipshot
npm install
npm run build # compile TypeScript
npm test # run tests (64 tests)
npm run test:watch # watch mode
npm run build:plugin # build the IntelliJ plugin zip
npm run build:vscode # build the VS Code extension (.vsix)CI (.github/workflows/ci.yml) builds and tests every push and PR on master. Publishing a release is one tag away:
git tag v1.1.0 && git push origin v1.1.0The release workflow (.github/workflows/release.yml) then runs the tests, cross-compiles the standalone binaries for all four platforms, builds the IntelliJ plugin zip and the VS Code .vsix, and attaches them all to a GitHub Release (.tar.gz for Linux/macOS with the executable bit preserved, .zip for Windows). Publishing the extension to the Visual Studio Marketplace or Open VSX is opt-in: it happens only when a VSCE_PAT or OVSX_PAT repository secret exists.
MIT







