Sunday, 13 April 2014

Capture Screenshots using terminal or script with Shutter

For screenshots my favorite Linux tool is 'Shutter' which has lots of features. It can be useful to capture a screenshot using the terminal or a script. This post details how you can quickly use it on Linux Mint or Ubuntu.

  • To install shutter
$ sudo apt-get -y install shutter
  • Also useful to install (details at end of post)
$ sudo apt-get -y install gnome-web-photo libnet-dbus-glib-perl libimage-exif-perl libimage-exiftool-perl
  • Capture the full screen :
$ shutter -e -f -o FullScreen.png
  • Capture active window :
$ shutter -e -a -o ActiveWindow.png

Syntax

-a : Capture the current active window
-e : Exit after the first capture has been made
-f : Capture the entire screen 
-o : Filename to save the screenshot

Note : You can save to jpeg, png, gif and bmp format

  • Using a sleep command with shutter enables you to setup the capture as required :

$ sleep 5 && shutter -e -f -o FullScreen.png

  • Then open the file e.g. my workspace 



  • A simple bash script is


  • This example will create a file called 'FullScreen.png' after 5 seconds under the directory '~/Pictures/screenshots/' 
$ CaptureFullScreen.sh FullScreen

Some Useful Things

  • You can add the script under the a bin directory in your home folder i.e. mkdir ~/bin/
  • Add your bin directory (insert your username for <username>) to your PATH within ~/.bashrc
Syntax 

export PATH=/home/<username>/bin:$PATH

Example

export PATH=/home/cwishaw/bin:$PATH
  • Give the file executable privileges
$ chmod +x CaptureFullScreen.sh
  • Using a fast access top down terminal like Guake is great to quickly start scripts with F12
  • Further details can be found with 'man shutter'

Additional Package details

  • gnome-web-photo: Create snapshot images and print web pages from the command line
  • libnet-dbus-glib-perl - extension for the DBus GLib bindings
  • libimage-exiftool-perl - Library and program to read and write meta information in multimedia files
  • libimage-exif-perl - Perl module to extract EXIF information from image files

No comments:

Post a Comment