Adding Screen Print to Raspbian
This tutorial will show you how to add screen printing ability to Raspbian "wheezy". It should also work for the other Debian/LXDE versions out there also.
When you are done, you will be able to capture either 1) your entire Desktop: Now, in 5 seconds, in 10 seconds or 2) just a selected area of the Desktop.
To add the ability to create an image of your desktop or sections of it, we will need to create some directories, install a program called Scrot and add 4 scripts and 4 .desktop files.
NOTE: These instructions are hardcoded for the base installation userid pi. If you have are using a different userid, you will have to modify the code to reflect the userid you are using.
Create a bin directory. (If you already have this directory, ignore this step)
cd
mkdir bin
Create a images directory. (If you already have this directory, ignore this step)
cd
mkdir images
Download Scrot
sudo apt-get update sudo apt-get install scrot
Create 4 scripts in the bin directory.
cd ~/bin
touch scrprint-now.sh scrprint-5sec.sh scrprint-10sec.sh scrprint-select.sh
Open your favorite text editor and add this code to each of the files. All these scripts are variations on the same theme but for "completeness" sake, here are the four files.
scrprint-now.sh
scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & gpicview ~/images/$f'
scrprint-5sec.sh
scrot -d 5 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & gpicview ~/images/$f'
scrprint-10sec.sh
scrot -d 10 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & gpicview ~/images/$f'
scrprint-select.sh
scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & gpicview ~/images/$f'
Now you need to make those shell scripts executable
chmod +x scrprint-now.sh scrprint-5sec.sh scrprint-10sec.sh scrprint-select.sh
As a shortcut, you could also do: chmod +x scrprint*
Create an applications directory in .local/share First let's check to see if it's there already:
cd ~/.local/share
ls
If you see the applications directory there already, cd into it, else
mkdir applications
cd applications
Add 4 new desktop files in the applications directory
Create the following 4 desktop files
touch ScreenPrint.desktop ScreenPrint5.desktop ScreenPrint10.desktop ScreenPrintSelect.desktop
Open your favorite text editor and add this code to each of the files.
ScreenPrint.desktop
[Desktop Entry] Type=Application Name=Screen Print - Now Comment=Scrot Screen Print Categories=Screen Print Exec=/home/pi/bin/scrprint-now.sh %U StartupNotify=true Terminal=false
ScreenPrint5.desktop
[Desktop Entry] Type=Application Name=Screen Print - 5 seconds Comment=Scrot Screen Print Categories=Screen Print Exec=/home/pi/bin/scrprint-5sec.sh %U StartupNotify=true Terminal=false
ScreenPrint10.desktop
[Desktop Entry] Type=Application Name=Screen Print - 10 seconds Comment=Scrot Screen Print Categories=Screen Print Exec=/home/pi/bin/scrprint-10sec.sh %U StartupNotify=true Terminal=false
ScreenPrintSelect.desktop
[Desktop Entry] Type=Application Name=Screen Print - Selected Area Comment=Scrot Screen Print Categories=Screen Print Exec=/home/pi/bin/scrprint-select.sh %U StartupNotify=true Terminal=false
These will show up in the Main Menu under the Other category.
Give it a try!
When you run these scripts, the image will be stored in the ~/images directory and GPicView (AKA: Image Viewer) will pop up and show you the image.
The first three just run as advertised.
For the "Select" option, click it in the Main Menu, then with the mouse, click, then drag over the area you want to capture. When you release the mouse button, whatever is in the "selected box" will be captured.