CLI screenshot tool for macOS with Retina support.
The goal of this tool is to be near-compatible with macOS
screencapture(1)
command,
with some extra additions, like the possibility to capture both 1x and
2x versions of the screenshot on Retina screens.
This is useful, say, if you want two native captures of the same window, both at a regular resolution and at a Retina resolution. This way you can get the best rendering in both cases, without any artificial downscaling.
You can also get only the 1x resolution e.g. for embedding on many sites that don't support 2x images, to avoid your screenshots looking 4 times bigger than they should be.
git clone https://github.com/valeriangalliat/retina-screenshot.git
cd retina-screenshot
make
./retina-screenshot --help
retina-screenshot
If you have two screens, this will save, e.g.:
~/Desktop/Screenshot YYYY-MM-DD at hh.mm.ss.png
~/Desktop/Screenshot YYYY-MM-DD at [email protected]
~/Desktop/Screenshot YYYY-MM-DD at hh.mm.ss (2).png
~/Desktop/Screenshot YYYY-MM-DD at hh.mm.ss (2)@2x.png
It will respect the default screenshot location you have set in macOS screenshot utility. You can see it by running:
defaults read com.apple.screencapture location
Or by pressing Command + Shift + 5 and looking at the Options > Save to value.
retina-screenshot screen1.png screen2.png
You will get:
screen1.png
[email protected]
screen2.png
[email protected]
If you have two screens and you only specify a single filename, it will only capture the main screen.
retina-screenshot -q 1x
retina-screenshot --quality 1x
retina-screenshot --quality 2x
retina-screenshot --quality both
Defaults to both.
retina-screenshot -i
retina-screenshot --interactive
This will show an interactive UI that mimics the default macOS screenshot tool, where you can cycle between mouse, window and screen selection mode with the space bar.
The filename behavior will be the same as noninteractive mode.
retina-screenshot --f
retina-screenshot --dialog
Instead of automatically generating the filename, or taking it from the CLI arguments, you will get an interactive dialog to select where to save the file(s).
In window selection mode, do not capture the shadow.
retina-screenshot -o
retina-screenshot --no-shadow
retina-screenshot -t png
retina-screenshot --format png
retina-screenshot --format jpg
retina-screenshot --format tiff
Defaults to PNG.
retina-capture -e
retina-capture --everything
The screens will be arranged like configured in displays preferences. Uncovered areas are transparent.
Basic linting:
make lint
Deeper linting:
make analyze