Capture from the command line
Use glimmer capture to take screenshots of a window, a display, a rectangle or the whole desktop from Terminal and scripts.
glimmer capture (--region | --rect X,Y,W,H | --window [selectors] | --display D | --screen) [-o FILE] [options]
What to capture#
| Option | Captures |
|---|---|
--region | A region you drag on screen. Needs someone at the Mac. |
--rect X,Y,W,H | A rectangle in points, from the top-left of the main display. |
--window | A window. See Choosing a window. Any window selector implies --window. |
--display D | One display. See Choosing a display. |
--screen | Every display, as one image. For the main display alone, use --display 1. |
Options#
| Option | Meaning |
|---|---|
-o FILE | Write to a file. -o - is standard output. |
--format png|jpeg|heic|tiff | Default: from the -o extension, else PNG. |
--cursor | Include the pointer. |
--no-shadow | Leave out a window’s shadow. |
--no-menu-bar | Leave out the menu bar. |
--delay SECONDS | Wait first, up to 60. |
--max-dimension PIXELS | Scale down so the long edge is at most this (at least 16). |
--save | Also keep the capture in the Library. |
Glimmer won’t write image bytes to a terminal. Without -o, redirect or pipe the output.
glimmer capture --bundle-id com.apple.Safari -o safari.png
glimmer capture --display "LG UltraFine" --format jpeg > desk.jpg
glimmer capture --screen -o desktop.png
Choosing a window#
With no selector, the frontmost window is captured. Selectors combine; the frontmost match wins.
| Selector | Matches |
|---|---|
--bundle-id ID | The app’s bundle ID, any case. The most reliable. |
--app NAME | The app’s name, exact, any case. |
--title REGEX | A regular expression found anywhere in the window title. |
--window-id N | A window ID from glimmer windows. |
--index N | The Nth match, front to back, from 1. |
glimmer windows lists what can be captured. Error messages never print other windows’ titles.
Choosing a display#
--display takes a display’s UUID (stable across restarts), its name (or a unique part of it) or its number. Number 1 is the main display, then left to right and top to bottom. Numbers change when you rearrange displays, so use the UUID in scripts. glimmer displays lists them.
Redaction#
Captures pass through your redaction settings before they leave Glimmer. If something needs a person to review it first, the command fails with exit code 14 and no image.
Next#
Something missing or unclear? Write to [email protected].