Scroll to navigation

scrot(1) command line screen capture utility scrot(1)

NAME

scrot - command line screen capture utility

SYNOPSIS

scrot [-bcfhimopuvz] [-a X,Y,W,H] [-C NAME] [-D DISPLAY] [-d SEC] [-e CMD]

[-k OPT] [-l STYLE] [-M NUM] [-n OPTS] [-q NUM] [-s OPTS] [-t % | WxH]
[-w NUM] [[-F] FILE]

DESCRIPTION

scrot (SCReenshOT) is a simple command line screen capture utility, it uses imlib2 to grab and save images.

scrot has many useful features:

  • Support for multiple image formats: JPG, PNG, GIF, and others.
  • The screenshot's quality is configurable.
  • It is possible to capture a specific window or a rectangular area on the screen.

Because scrot is a command line utility, it can easily be scripted and put to novel uses. For instance, scrot can be used to monitor an X server in absence.

scrot is free software under the MIT-feh license.

OPTIONS

Non-interactively choose a rectangle starting at position X,Y and of W by H resolution.
When selecting a window, grab the WM's border too. Use with -s to raise the focus of the window.
NAME is a window class name. Associative with -k.
Display a countdown when used with -d.
DISPLAY is the display to use; see X(7).
Wait SEC seconds before taking a shot. When given the `b` prefix, e.g `-d b8`, the delay will be applied before selection.
Execute CMD on the saved image.
Specify the output file. If FILE is "-", scrot will output the image to stdout. The filename is expanded according to the format specified in SPECIAL STRINGS. The output file may be specified through the -F option, or as a non-option argument.
Freeze the screen when -s is used.
Display help and exit.
Don't exit for keyboard input. ESC still exits.
Capture stack/overlapped windows and join them. A running Composite Manager is needed for it to work correctly. OPT is optional join letter: v/h (vertical/horizontal). Default: h
STYLE indicates the style of the line when the -s option is used; see SELECTION STYLE.
Capture Xinerama monitor number NUM.
For multiple heads, screenshot all of them in order.
By default scrot does not overwrite the output FILE, use this option to enable it.
Capture the mouse pointer.
NUM must be within [1, 100]. A higher value represents better quality image and a lower value represents worse quality image. Effect of this flag depends on the file format, see COMPRESSION QUALITY section. Default: 75.
Interactively select a window or rectangle with the mouse, use the arrow keys to resize. See the -l and -f options. OPTS it's optional; see SELECTION MODE
Also generate a thumbnail. The argument represents the thumbnail's resolution: if the argument is a single number, it is a percentage of the full size screenshot's resolution; if it is 2 numbers separated by an "x" character, it is a resolution. If one of the resolution's dimensions is 0, it is replaced by a number that maintains the full size screenshot's aspect ratio. Examples: 10, 25, 320x240, 500x200, 100x0, 0x480. -u, --focused, --focussed Use the currently focused window.
Output version information and exit.
Window identifier to capture. WID must be a valid identifier (see xwininfo(1)).
Compression level to use, LVL must be within [0, 9]. Higher level compression provides lower file size at the cost of slower encoding/saving speed. Effect of this flag depends on the file format, see COMPRESSION QUALITY section. Default: 7.
Prevent beeping.
Specify the output file format. E.g "--format png". If no format is specified, scrot will use the file extension to determine the format. If filename does not have an extension either, then PNG will be used as fallback.
List all program options. If argument is "tsv" it outputs a TAB separated list intended for scripts. Default is "human". Note that the tsv format is not stable and may change in the future.

SPECIAL STRINGS

-e, -F and FILE parameters can take format specifiers that are expanded by scrot when encountered. There are two types of format specifier: Characters preceded by a '%' are interpreted by strftime(3). The second kind are internal to scrot and are prefixed by '$'. The following specifiers are recognised by scrot:


$$ A literal '$'.
$a The system's hostname.
$F The output file format.
$f The image's full path (ignored when used in the filename).
$h The image's height.
$m The thumbnail's full path (ignored when used in the filename).
$n The image's basename (ignored when used in the filename).
$p The image's pixel size.
$s The image's size in bytes (ignored when used in the filename).
$t The image's file format (ignored when used in the filename).
$w The image's width.
$W The name of the window (only for --select, --focused and --window).
\n A literal newline (ignored when used in the filename).
Example:


$ scrot '%Y-%m-%d_$wx$h.png' -e 'du -h $f'
This would create a PNG file with a name similar to 2000-10-30_2560x1024.png and show the disk-usage with du(1).

SELECTION MODE

When using -s, optionally you can indicate the action to perform with the selection area. Some actions allow optional parameters too.


capture Capture the selection area, this action is by default and
does not need to be specified.
hole Highlight the selected area overshadowing the rest of the capture.
hide,IMAGE Hide the selection area by drawing an area of color (or image) over it.
Optionally indicate name of the image to use as cover.
Image has priority over color.
blur,AMOUNT Blurs the selection area.
Optionally you can specify the amount of blur.
Amount must be within [1, 30]. Default: 18.
In modes 'hole' and 'hide' the color of the area is indicated by 'color' property of the line style and the opacity of the color (or image) is indicated by property 'opacity', SELECTION STYLE

If the 'hide' mode uses an image that does not have an alpha channel, the opacity parameter will be ignored and it will be drawn fully opaque.

Examples:


$ scrot --select=hide
$ scrot -shole --line color="Dark Salmon",opacity=200
$ scrot -sblur,10
$ scrot -shide,stamp.png --line opacity=120

SELECTION STYLE

When using -s, you can indicate the style of the line with -l.

-l takes a comma-separated list of specifiers as argument:


style=STYLE STYLE is either "solid" or "dash" without quotes.
width=NUM NUM is a pixel count within [1, 8].
color="COLOR" Color is a hexadecimal HTML color code or the name of
a color. HTML color codes are composed of a pound
sign '#' followed by a sequence of 3 2-digit
hexadecimal numbers which represent red, green, and
blue respectively. Examples: #FF0000 (red), #E0FFFF
(light cyan), #000000 (black).
opacity=NUM NUM is within [0, 255]. 255 means 100% opaque, 0 means
100% transparent. For the opacity of the line, this is only
effective if the compositor supports _NET_WM_WINDOW_OPACITY.
mode=MODE MODE can be "auto", "edge" or "classic" without quotes.
edge is the new selection, classic uses the old one.
"auto" uses "edge" if no compositor is running, "classic"
otherwise. "edge" ignores the style specifier and the -f flag,
"classic" ignores the opacity specifier.
Without the -l option, a default style is used:


mode=auto,style=solid,width=1,opacity=100
Example:


$ scrot -l style=dash,width=3,color="red" -s

COMPRESSION QUALITY

For lossless formats (e.g PNG), the quality options is ignored. For lossy formats where the quality and compression are tied together (e.g JPEG), compression will be ignored. And for image formats where quality and compression can be independently set (e.g WebP, JXL), both flags are respected.

EXAMPLES

Following are a couple examples of using scrot with other utilities.

Copying screenshot to clipboard using xclip(1):


$ scrot - | xclip -selection clipboard -target image/png
Taking a screenshot and optimizing its size with optipng(1):


$ scrot -e 'optipng -o4 $f'
Selecting a window by PID with xdo(1):


$ scrot -w $(xdo id -p PID)
Taking a screenshot and annotating it with ImageMagick(1):


$ scrot - | convert -pointsize 64 -gravity North -annotate '+16+16' 'hello, world!' - out.png

AUTHOR

scrot was originally developed by Tom Gilbert.

Currently, source code is maintained by volunteers. Newer versions are available at https://github.com/resurrecting-open-source-projects/scrot

SEE ALSO

ImageMagick(1) optipng(1) xclip(1) xdo(1) xwininfo(1)

09 Jun 2024 scrot-1.11