Raspberry Pi is an affordable tiny computer with a wide range of use cases. It primarily runs on the Raspberry Pi OS, though you can use any other Linux-based operating system on it as per your requirements.
In general, Pi’s applications don’t present situations where you’d want to capture what’s on the screen. However, there are instances when you might need to do so: perhaps to document a process, help someone troubleshoot their Pi, or capture error messages on your display. And that’s where screenshots come in handy.
Here’s how to take screenshots on Raspberry Pi in two different ways.
1. Taking Screenshots Using Scrot
Scrot is a command-line screenshot utility that offers a host of screen-capturing capabilities, ranging from delaying screenshot capturing and specifying directory and file name to limiting the scope of capturing, creating thumbnails, and invoking third-party utilities to manipulate the screenshot.
Scrot comes pre-installed on most Linux distros, including Raspberry Pi OS. However, if you’re running some other distro or a lite version of Raspberry Pi OS, you can install it manually by entering the following command in the Terminal:
sudo apt install scrot
With Scrot, you can capture the screen in several ways. Some of these involve specifying parameters, which lets you choose the specifics of your screenshots.
Usually, the conventional way to take a screenshot on any device is to capture the entire screen and then crop out unrequired bits in post-processing. In Scrot, you can do this in two ways: by pressing the PrtScr (Print Screen) key on your keyboard or by using the scrot command in the Terminal.
Once you take the screenshot, Scrot will save it to the Pictures directory on your Raspberry Pi. By default, Scrot uses the date and time of the screen capture for its file naming scheme.
For the directory name use the syntax:
So you might use:
Specifying the filename uses this syntax:
Usage here might be:
You can also use Scrot to take a screenshot of a specific window on your screen at a time. To do this, type: scrot -s and select the window to capture. Alternatively, you can draw out a box around the window to capture it with borders.
Moving on to advanced features territory, Scrot offers the option of delaying screenshot capturing so that you can choose the window you wish to capture before it takes the screenshot.
To delay a screenshot, use scrot -d num (where num is the number of seconds). You can also add a countdown timer to see the elapsed seconds by adding the c parameter to the command: scrot -cd 10.
Other Scrot screenshot parameters include:
- scrot -b – to grab the border of a window
- scrot -t – to create a thumbnail out of the screenshot
- scrot -u – to capture the currently focussed window
- scrot -e – to specify a command to run after a screenshot is captured
- scrot -v – to get the current version of Scrot
- scrot -h – to display additional help
If your Raspberry Pi is set up in a headless configuration, or you want to take screenshots remotely, Scrot makes it possible to capture screenshots in such settings using SSH (Secure SHell).
To do this, you must first enable SSH on your Raspberry Pi. Once that’s done, you need to enter the following command in the Terminal to take a screenshot: DISPLAY=:0 scrot. (Here, DISPLAY defines the environment variable, which we’ve set to :0 since that’s your Pi’s local display.)
2. Taking Screenshots Using GNOME Screenshot
GNOME Screenshot is a screenshot utility built into the GNOME desktop environment. It used to be a part of the gnome-utilities package, but now it’s available as a separate package. You can install GNOME Screenshot on your Raspberry Pi with just a simple command:
sudo apt install gnome-screenshot
Unlike Scrot, GNOME Screenshot comes with a GUI (Graphical User Interface), which is much easier to operate. So, if interacting with Terminal isn’t your strong suit, you can use it to take pretty much all kinds of screenshots on your Pi.
GNOME Screenshot offers lots of screen-capturing options. Follow the instructions below to learn how to use them.
- Click the Raspberry Pi menu in the top-left of the screen, select Accessories, and run Screenshot.
In the Screenshot window, you get three capturing modes:
- Grab the whole screen: Lets you capture the entire screen. You also get the option to add a delay in capture and choose to include the pointer in your screenshot.
- Grab the current window: Lets you take a screenshot of the current window. You can also set a delay period, include the pointer, and apply a border effect to the captured screenshot.
- Select area to grab: Lets you select the area that you want to capture in your screenshot.
Select a mode that best suits your needs.
- Click on the Take Screenshot button to take a screenshot. If you pick the third mode, you’ll need to select the area you want to capture instead: use your mouse to draw out this area.
GNOME Screenshot will now display the captured screenshot with a couple of options. You can either Save the screenshot (with the default settings) or Copy to Clipboard to paste the screenshot to another location.
If you decide to save the screenshot, you get the option to change the filename and pick the directory where you’d like to save your screenshot.
A downside to using GNOME Screenshot is that it terminates immediately after taking a screenshot. So, if you want to take multiple screenshots, you have to relaunch the application each time.
One way to work around this is to create a keyboard shortcut to launch GNOME Screenshot easily. Here’s how.
- Open the Terminal and enter the following command to open the configuration file: sudo nano /etc/xdg/openbox/lxde-pi-rc.xml.
Scroll down to the section that reads Keybindings for running applications and add the following lines of code to the file:
Use the key declarations below to create keybindings:
- A – ALT
- C – CTRL
- S – Shift
- W – Windows
- space – Spacebar
- Home – Home
- End – End
- Return – Enter
- Press CTRL + O to make changes and CTRL + X to exit.
- Enter sudo reboot in the Terminal to reboot Raspberry Pi and apply your keybindings.
You can now launch GNOME-Screenshot with the keyboard shortcut you just assigned and save yourself a few steps.
Capturing Screenshots on Raspberry Pi Made Easy
Scrot and GNOME Screenshot both offer a robust and convenient way of capturing screenshots on the Raspberry Pi. They are compatible with all Raspberry Pi models, and you can use them to take screenshots on Raspberry Pi OS or any other Linux-based distro running on your Pi.
Looking for a way to record your Linux desktop? Here are several ways to do it, including some options that’ll even record your Raspberry Pi’s screen.
About The Author