How to Capture Screenshots on Raspberry Pi
No matter what kind of computer you're using, there are times when you need to take a screenshot. Perhaps you want to write instructions that show others how to perform a task or maybe you want to share something you saw in an app or web page.
It's easy to take screenshots on any Raspberry Pi model, at least if you use Raspbian, the official Pi OS. The following instructions were made on a Raspberry Pi 4 running the latest version of the operating system, Raspbian Buster, but they will definitely work on any other model and any recent version of the OS. By the way, we also have articles on how to take screenshots in Windows 10 or 11 and how to record the screen in Windows.
Capture Screenshots Using Scrot and PrtScr
Raspbian's built-in screenshot tool is called Scrot and you can use it capture the whole screen just by hitting the PrtSc (printscreen) key. After you hit PrtSrc, Scrot will save a PNG graphics file to your home folder (/home/pi by default) with the date and time as the file name.
However, you can also use Scrot via the command line to get some additional flexibility. For example, if you want to take a screen shot after a delay, you can open a terminal window and type the command "scrot -d" followed by the number of seconds of delay. For example, for a five second delay type:
scrot -d 5
If you want to capture a particular window use the -s option and then click the window you want and it will be saved. Make -sb if you want the window's border in the shot.
scrot -sb
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
And if you want to give the file a different name that's not the date and time, you can put the file name after the word "scrot." For example, this command will capture your selected window and name it myimage.png
scrot myimage.png -sb
Using Gnome Screenshot
Scrot is nice for a commandline tool, but it's easier to use a screenshot tool with a graphical interface. The main graphical screenshot tool for the Pi is Gnome Screen shot. You can install it by typing.
sudo apt install gnome-screenshot
As always when installing software, you'll want to make sure you have all your apps and repositories updated before the install. So, if you haven't done that recently, make sure you type:
sudo apt update && sudo apt upgrade
Now you can find Gnome Screen shot in your accessories menu, listed as "Screenshot"
Once you have Gnome Screenshot open, you have the option to capture the entire screen, a single window or any portion you draw a box around. You also can select a delay and toggle whether the mouse pointer appears in the show (by default it doesn't).
After you've captured your screenshot, Gnome Screenshot gives you the option of either copying it to the clipboard, presumably so you can paste it into an image editor like GIMP, or saving it with the file name of your choice.
Making a Keyboard Shortcut for Gnome Screenshot
The one real downside to Gnome Screenshot is that, as soon as you save one picture, the app closes and you need to launch it again for the next capture. That's a lot of extra clicking if you're taking many shots in one session.
Fortunately, if you follow our instructions on how to create custom keyboard shortcuts for Raspberry Pi, you can assign Gnome Screenshot to any key combo you want. In fact, you can change the configuration so PrtSrc launches Gnome Screenshot instead of Scrot. In short, you must
1. Open the /etc/xdg/openbox/lxde-pi-rc.xml file for editing.
sudo nano /etc/xdg/openbox/lxde-pi-rc.xml
2. Add the following code somewhere under the <keyboard> section.
<keybind key="C-A-Print]"><action name="Execute"><command>gnome-screenshot --interactive</command></action></keybind>
That will assign Gnome Screenshot to CTRL + ALT + PrtScr, but you can also override the regular PrtSrc command that launches Scrot by editing it in this section.