Skip to main content
# 📸 screenshot: Better macOS screenshots via the Terminal

`screenshot` is a command line utility that lets you specify an *application name* and *window title* in order to take a screenshot of a specific window.

Using `screenshot`, you can capture windows belonging to an application, or only an application's windows with certain titles.

## Justification and Use Case
The macOS `screencapture` utility is not developer friendly.

To programmatically take a screenshot of an application, or a specific window, you must supply a *window ID* to `screencapture`.
In order to find a window's *window ID*, you'll need call out to Quartz.

In newer versions of macOS, the `screencapture` utility improves the user experience slightly: you can run the command and then click on the window you'd like to capture.

However, that necessitates that the user clicks a window each time. You cannot include this as part of an automated pipeline.

To that end, I use this utility to automatically generate screenshots of web, mobile and desktop applications.

## Example
Take a screenshot of the current Terminal window and view it with Preview.app:
```bash
open "`screenshot Terminal`"
```

Take a screenshot of the Pycharm application with the *window title* containing "screenshot":
```bash
screenshot Pycharm -t screenshot
```


## Installation
You will need Python 3.6+. Please install it with `brew` or `ports` if you do not have it already.

### PyPI
```bash
pip3 install screenshot
```

### Github Source
Grab the source, run the following in the source dir:
```bash
pip3 install -r requirements.txt
```

then run
```bash
python3 setup.py install
```

## Usage
`screenshot --help`

```
Usage: screenshot [OPTIONS] APPLICATION_NAME

Options:
-w, --window_selection_options TEXT
Options: all_windows, on_screen_only,
above_window, below_window, include_window,
exclude_desktop
Default: exclude_desktop
on_screen_only
-t, --title TEXT Title of window from APPLICATION_NAME to
capture.
-f, --filename TEXT Filename to save the captured PNG as.
-a, --all_windows Capture all windows matching parameters.
-o, --output TEXT Image format to create, default is png
(other options include pdf, jpg, tiff)
-s, --shadow Capture the shadow of the window.
--help Show this message and exit.
```

## License
See `LICENSE`


Metadata

Release files for screenshot 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for screenshot 1.0.0
File Size Uploaded
screenshot-1.0.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for screenshot 1.0.0
File Interpreter ABI Platform
screenshot-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / screenshot-1.0.0.tar.gz

Download URL screenshot-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
14b1a22f24647ae53684754f19bd374567e0d71377ddad9d13023b6deda4d501
BLAKE2b-256 checksum
How to use checksums
34906f5286b2bb3657176a80706b340627dff1f2139bdbebebf9d5b01de86940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.13.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

Release files / screenshot-1.0.0-py3-none-any.whl

Download URL screenshot-1.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08fce3e2dc07ebdbfeb61aa34baf44267f64229e2f145733321182c3565dc5c9
BLAKE2b-256 checksum
How to use checksums
1013755aa410267361f40cef938668b48ab443a5ffc0860f0ed293b498f5952e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.13.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

Release history Release notifications | RSS feed

1.0.1

1 release file

This release

1.0.0 This release

2 release files

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page