LINUXUSER Console with Scrot Tomo Jesenicnik, Fotolia

Screenshots from the console with Scrot TYPE

Scrot helps users grab screenshots conveniently and quickly at the command line. BY KARL DEUTSCH

inux users often rely on screen- manually. On OpenSUSE 10.2, for line and suse/10.1 in the line below, and shots to document the state of instance, make sure the imlib2 and then click on Finish. YaST will now read Ltheir desktops. Most distros imlib2-loaders libraries are installed on the external package list. Then, relying include some kind of GUI-based screen- your system. Then go on to download on YaST to handle the dependencies, you shot tool, such as Ksnapshot, Gimp, or the scrot-0.8-1.i386.rpm and giblib-1.2. can proceed to install Scrot in the nor- Gnome-, but some users pre- 4-0.pm.0.586.rpm packages from the mal way. fer to generate quick shots from the con- LinuxBrit [2] and Packman [3] sites, Users with Ubuntu “Edgy Eft” have an sole. An alternative screenshot utility respectively. easier task – after enabling the Universe called Scrot [1] runs from the command To install the packages, change to the package repository, you can use Synaptic line. Scrot offers some features the GUI- download directory, become root, and to install Scrot. Select Settings | Reposito- based programs don’t provide, such as enter rpm -Uhv *.rpm. ries and, at the top of the Ubuntu 6.10 automatic thumbnail generation and the If you use SUSE 10.1, you will tab, check Community maintained Open ability to compress images. need to add Packman as an additional Source Software (universe). package repository. In YaST, select Soft- Installation ware | Change installation source, click Launching the Program Scrot is not included with many Linux Add to add a new FTP source, type pack- The easiest way to launch Scrot is to distros, so you might have to install it man.iu-bremen.de in the Server name type scrot at the command line. This

84 ISSUE 80 JULY 2007 WWW.LINUX - MAGAZINE.COM Console Screenshots with Scrot LINUXUSER

If you intend to publish your screen- shots in a web-based gallery, you will definitely need thumbnails. To create a thumbnail, just pass in the -t option and a number to Scrot. The number specifies the relative size of the thumbnail to the original image as Figure 1: A countdown feature for the autotimer lets you know how many seconds you a percentage. If you enter, say, 50, the have left. thumbnail will be half the size of the original. The thumbnail file is automati- command creates a snapshot of the wait for an interesting screen to appear. cally labeled with a -thumb suffix. whole workspace and drops it into your The autotimer feature can help you with To automatically pass an image you current working directory. The PNG file- this. For example, the command have grabbed to another application, name comprises the date and time, the you can set the -e option, followed by screen resolution, and a suffix of _scrot. scrot -d 5 - workspace.png the command line or application name. png. To use your own filename, just pass To view a screenshot after grabbing, a the name to Scrot when you launch the uses the -d parameter to specify a 5-sec- combination with Display might be a program: scrot .png, or scrot ond delay. The -c switch additionally dis- good idea: /path/to/.png. plays a countdown to let you know when Scrot will press the button (Figure 1). scrot filename.png -e U Windows and Areas 'display filename.png'. You might need to grab a single window Image Quality and or a screen area from time to time. To do Compression The Display tool is included with most so, specify the -s option in front of the Scrot generates fairly large files: a distributions, but if not, just install the filename. After pressing Enter, click the screenshot at a resolution of 1280 by Imagemagick package. window that you want to grab. 1024 pixels will weigh in at about 1MB. Because Scrot will normally just grab To save storage space, you might like to Conclusions the window without any decorations, change the image quality and compres- The Scrot command-line screenshot tool you will need to set the -b flag to tell sion with the -q switch. is useful if you need more flexibility than Scrot to grab the border: The range is between 0 and 100, with GUI-based tools can offer. Table 1 pro- a default of 75. A higher value creates a vides an overview of some important scrot -s -b window.png file with a low compression level; Scrot parameter options. smaller values give you small-footprint Because the Scrot tool does not rely If you need a screenshot of a screen files with a higher compression level. on user interaction, it is also suitable for area, again specify the -s option, hold Because Scrot stores images in PNG for- scripting. To create delayed serial snap- down the left mouse button while mat, which uses loss-free compression, shots or to label your snapshots immedi- launching the program, and drag a you should use a value of less than 30 ately after grabbing them, you might square frame on the desktop. When the for storing larger image archives. also want to investigate another module frame reaches the required size, release from the Imagemagick package – the the left mouse button. You should hear a More Options Import tool. ■ beep to let you know that the screenshot The -m option is designed for power has been stored. users with multiple screens. The -m tells INFO Scrot to create a snapshot of each [1] Scrot homepage: linuxbrit. co. uk Autotimer screen. The tool automatically composes In some cases, it can take a while to ar- a single image from all the individual [2] Download Scrot RPM for SUSE 10.2: http:// linuxbrit. co. uk/ downloads/ range the window, or you might need to snapshots. scrot-0. 8-1. i386. rpm Table 1: Important Scrot Parameters [3] Download the Giblib package for SUSE 10.2: http:// packman. Parameter Description links2linux. org/ download/ giblib/ -b Creates a snapshot with the window border 44943/ giblib-1. 2. 4-0. pm. 0. i586.rpm -c Displays a countdown -d Specifies the delay before the screenshot in seconds Karl Deutsch is the author of the -e Runs an application or command book Linux für Windows-Adminis- -q Specifies an image quality setting from 0 to 100, with a default of 75 tratoren (German). He is an IT -m Includes all screens on a multiple-screen system consultant and the proprietor of -s Selects a window or screen area for the snapshot IT-Works.co.at. Karl has used -t Creates a scaled-down thumbnail various Linux distributions for his Typing “man scrot” displays a parameter list.

THEAUTHOR daily work since 1997.

WWW.LINUX - MAGAZINE.COM ISSUE 80 JULY 2007 85