Knowledge for the World

How to take screenshots on the Raspberry Pi

I write a lot of guides on howchoo and sometimes I need to show the reader what's on my Raspberry Pi's screen.

This short guide will teach you how to take Raspberry Pi screenshots, allowing you to capture screen grabs of whatever your Pi is currently displaying!

1

Connect to your Pi

Open your favorite command line program and log into your Raspberry Pi via SSH.

2

We're going to use the raspi2png library to take screenshots. I tested out several screen capture applications for the Raspberry Pi and this one consistently performed the best.

After logging into your Pi, download the project from the raspi2png Github repository:

git clone https://github.com/AndrewFromMelbourne/raspi2png

Then, copy it to the usr/local/bin directory (or create an alias):

sudo cp -a raspi2png/raspi2png /usr/local/bin
3

Take a screenshot

To take a screenshot, run the following command:

raspi2png -p screenshot-name.png

I recommend creating a screenshots directory. I created one in ~/screenshots:

sudo mkdir ~/screenshots

Then, when you take a screenshot, you can either cd to that directory and run the screenshot command:

cd ~/screenshots
raspi2png -p screenshot-name.png

.. or, you can specify that directory when you run the command from anywhere:

raspi2png -p ~/screenshots/screenshot-name.png
4

Screenshot options

As the name suggests, raspi2png outputs PNGS, which is generally the format you want for taking photos of text, menu systems, and retro games. PNG is a lossless format, so it's ideal for cases like this that have fewer colors, and won't result in any compression artifacts.

You can optionally specify width/height, compression level, which Raspberry Pi display to screenshot (in case you have a multi-monitor setup on your Pi.. for some reason), etc.

For example, if I wanted a smaller PNG (though lower quality), I could specify a higher compression level:

raspi2png -p screenshot-name.png -c 5

Options and their usage are documented in the raspi2png readme file.