Saturday, 19 January 2013

Screenshots of multiple webpages using openSUSE 12.2 GNOME 3.4.2

 In order to capture screenshots of multiple webpages using openSUSE 12.2, GNOME 3.4.2 we need to use a screenshot tool can "gnome-web-photo". GNOME Web Photographer is a tool that can be used to generate full-size image files and thumbnails from HTML files and web pages. Optionally, we can use zenity (GNOME Command Line Dialogue Utility) to inform the user about the completion of the process through an alert window. Both these packages should be installed by default on openSUSE 12.2, GNOME 3.4.2.
The usage of both the commands are as follows:-
Usage: gnome-web-photo [--mode=photo|thumbnail|print] [...]
Usage:  zenity [OPTION…]
  1. First we open nautilus and go to ~/bin folder , right click and choose "Create New Document" and then click on the submenu "Empty Document". We choose the newly created file and hit "F2" and rename the file to something like "LetItRip.sh".
  2. Then we right click on "LetItRip.sh" and choose file "Properties" . In the properties window  we open the "Permissions" tab. Here we will find a checkbox labelled "Execute". We select this checkbox and and close the properties window.
  3. We can then add the following lines of code to take the screenshots of relevant websites and put them in "public_html" folder.
/bin/sh -c 'gnome-web-photo  --mode=photo --file     http://www.dogpile.com ~/public_html/dogpile.png';
/bin/sh -c 'gnome-web-photo  --mode=photo --file     http://www.google.com    ~/public_html/google.png';
/bin/sh -c 'gnome-web-photo  --mode=photo --file     http://www.bbc.com    ~/public_html/bbc.png';
/bin/sh -c 'gnome-web-photo  --mode=thumbnail --file     http://www.dogpile.com ~/public_html/thumb_dogpile.png';
zenity --info --text "Capture Complete";
Notes :-
  • sh shell, the standard command language interpreter;
  • -c option reads commands from command_string operand;
  • --mode option tells us whether photo or thumbnail will be generated;
  • --file option specifies the URL that needs to scraped;
  • zenity is command used to create alert windows;
  • --info option tells zenity to display a "info" type alert;
  • --text is used to specify the text that zenity should display in the alert window;
 Create executable file and plugin the code as shown below
Executable file gnome-web-photo
Double click on executable and click on "Run" button. After creation of the screenshots you should see an alert like this.
gnome-web-photo execution
public_html folder with screenshots created from websites
gnome-web-photo website screenshot generated

No comments:

Post a Comment