There are several ways to take screenshots in Linux. Most of them produce a WebKit, Gecko (Firefox) or khtml rendered screenshot image. Some of the methods require X session to open a window and take screenshots.
Read how to take screenshots from command line in Windows in this my post.
gnome-screenshot (in Ubuntu Linux)
From the command-line, just type the command
gnome-screenshot
The command will take a screenshot and provide a dialog to save it.
Take the screenshot of the current active window alone:
gnome-screenshot -w
ImageMagick
You can use import command line tool of ImageMagick.
To install ImageMagick on Ubuntu Linux:
apt-get install imagemagick
Use the “-window root” option to take screenshot of the complete screen:
import -window root images/my1.png
wkhtmltopdf
http://code.google.com/p/wkhtmltopdf/
wkhtmltopdf is a command line utility that generates a pdf file from a webpage using webkit rendering engine.
wkhtmltoimage
http://code.google.com/p/wkhtmltopdf/downloads/list
The wkhtmltoimage takes a screenshot and saves it as a png image. It uses the webkit rendering engine.
The tool is created by the same team as wkhtmltopdf.
Cannot render flash animations. Sometimes it fails because of unknown reasons showing errors like:
cutycapt
http://cutycapt.sourceforge.net/
Cutycapt is a utility to take the screenshot of a url, using the webkit rendering engine and save it to an image file.
khtml2png
http://khtml2png.sourceforge.net/index.php?page=download
khtml2png uses the konqueror rendering engine to create screenshots of web pages.
python-webkit2png
https://github.com/AdamN/python-webkit2png/
PyWebShot
http://www.coderholic.com/pywebshot-generate-website-thumbnails-using-python/
https://github.com/coderholic/PyWebShot
Pywebshot uses python bindings embedded mozilla ( http://www.mozilla.org/unix/gtk-embedding.html )
Read more:
– a list of tools with the instructions how to install and use them:
http://www.binarytides.com/take-webpage-screenshot-from-command-line-in-ubuntu-linux/
– 4 Methods to Take Screenshot Capture in Ubuntu Linux –
http://www.thegeekstuff.com/2012/08/screenshot-ubuntu/
Discussions on StackOverflow:
3 thoughts on “Take screenshots of websites from command line in Linux”