banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Take Screenshots From The Command Line


by Paul Arnote (parnote)

Most everyone has taken a screenshot of their PCLinuxOS desktop. You've spent hours finding that perfect icon set, searching for that perfect wallpaper, arranging your panels just so, and getting everything else just how you like it. Then, it's time to show your masterpiece desktop off to the world. So, you take a screenshot to share with your fellow PCLinuxOS users in the PCLinuxOS forum.

To do so, most people might use KSnapshot, if they are using the KDE desktop. If you're using Xfce, you might use xfce-screenshooter. Mate users might use mate-screenshot. LXDE users might use screenie. Others may use Shutter, a standalone program capable of taking screenshots of any desktop. MTPaint and GIMP also have screenshot utilities.

But the majority of users probably wouldn't think of using a command line utility to take their screenshots. It probably shouldn't be much of a surprise, either, that such a utility exists, and it's in the PCLinuxOS repository. Scrot is a quick 15.5 KiB download from Synaptic.



To take a picture of the entire screen, just enter the command as follows in a terminal session on the command line:

scrot

Scrot will save the screenshot in the current directory as a date stamped PNG file. If you have a certain spot where you'd rather save the screenshot, enter a path and filename after the scrot command.

If you want to take a picture of a particular window or rectangular region, enter the command like this:

scrot -s

After you type the command and hit enter, use your mouse to either click on a window you want to capture, or draw a rectangular region on your screen. This will trigger a screen capture of the window or rectangular region. Just as when capturing the entire screen, you can also specify a path and filename at the end of the command.

You can also specify a delay before scrot takes a screenshot, like this:

scrot -s -d 5

The above command will wait five (5) seconds before taking a screenshot of the selected window or rectangular region.

Scrot will also resize your screen capture. Issue the command, like this:

scrot -t 50

This will resize the screenshot to 50% of its original size. Numbers between 1 and 100 are valid.

While the default quality of scrot is 75%, you can specify a different quality setting for the screenshot.

scrot -q 85

This will set the quality at 85%. Just like with the resize flag, valid numbers are 1 to 100, with the higher numbers signifying higher quality.

Of course, you can chain all of these command line flags together. For example:

scrot -s -d3 -t 75 -q 90 ~/Pictures/my-desktop.png

The above command will set a delay of three (3) seconds, taking a screenshot of the selected window or rectangular area, resize the image to 75%, set the quality at 90%, and save the screenshot in the /home/username/Pictures directory, as my-desktop.png.

See? It's very easy to take a screenshot from the command line. In fact, it's practically just as easy to do from the command line as it is to use one of the screenshot utilities that come with your favorite desktop. With a little help from zenity or gtkdialog, it shouldn't be too difficult to make a custom GUI screenshot utility. But we'll save that discussion for another time.



Previous Page              Top              Next Page