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
To take a Raspberry Pi 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
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.
The Raspberry Pi is a wonderfully flexible SBC and easily one of our favorite open-source boards on the market today.