Skip to content

LowLevelLore/zsnap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsnap

zsnap is a command‑line tool that captures the ANSI output of any shell command and renders it as an image. This is useful for embedding colorful terminal output into documentation, slides, or bug reports.


Features

  • Capture stdout (and optionally stderr) from any command
  • Preserve ANSI colors and formatting
  • Output to common image formats: PNG, JPG, JPEG, BMP
  • Configurable image width
  • Cross‑platform: supports both Unix shells and Windows cmd.exe

Installation

Prerequisites

  • Rust toolchain (stable)
  • On Linux/macOS: development headers for GTK/X11 if using system clipboards
  • On Windows: no additional dependencies

From crates.io

cargo install zsnap

From source

git clone https://github.com/yourusername/zsnap.git
cd zsnap
cargo build --release
cargo install --path .

Usage

zsnap --exec "ls --color=always" --out report.png

Usage: zsnap [OPTIONS]

Options:
  --exec                   Command to run and capture (with ANSI color codes)
  -o, --out                Output file path (png│jpg│jpeg│bmp) [optional]
  -w, --width              Width of the generated image in pixels [default: 800]
  -f, --format             Image format (png│jpg│jpeg│bmp) [default: "png"]
  --errors                 Include stderr output after stdout
  -h, --help               Print help information
  -V, --version            Print version information



## Examples

- Capture 'ls' and save as PNG:

```bash
zsnap --exec "ls --color=always" --out ls.png
  • Capture git diff with stderr included:
zsnap -e --exec "git diff HEAD~1 HEAD"
  • Use custom width and JPEG format:
zsnap -w 1200 -f jpg --exec "top -b -n 1"

Supported Platforms

  • Unix (Linux, macOS): uses $SHELL (or falls back to /bin/sh)
  • Windows: uses %COMSPEC% (defaults to cmd.exe)

License

This project is licensed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published