screenshot

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

screenshot

Capture the desktop to a PNG from the command line. A single binary with no server and no background process, so scripts and coding agents can call it straight from a shell.

Install

go install github.com/bosskrub9992/screenshot@latest

The binary lands in $(go env GOPATH)/bin (or $GOBIN); put that directory on PATH.

Usage

$ screenshot displays
[0] 1920x1080 at (0,0)
[1] 3440x1440 at (-763,-1440)

$ screenshot capture --display 1 --dir ~/shots --name login
C:\Users\me\shots\login.png
Command What it does
screenshot displays One line per active display: 0-based index, size and position in desktop coordinates
screenshot capture Capture to a PNG and print its absolute path on stdout

capture flags:

Flag Default Meaning
--display N all displays as one image 0-based display index from displays
--dir DIR screenshot in the OS temp directory Created if missing; a leading ~ expands to the home directory
--name NAME screenshot-YYYYMMDD-HHMMSS.png File name only, no path separators; .png is appended when it has no extension

-h works on every command.

Exit codes

Code Meaning
0 Success
1 Runtime failure: no display found, capture failed, file not writable
2 Usage error: unknown command or flag, display index out of range, --name with a path separator

Errors go to stderr; stdout carries only the result.

Platforms

Built on kbinani/screenshot. Windows is the platform it is used and tested on. Linux (X11) builds without cgo; macOS needs cgo.

Development

go vet ./...
go test ./...

Release by pushing a semver tag (vX.Y.Z); go install ...@latest picks it up.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址