Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed CutyCapt on my Linode VPS and using it to generate screenshots by following command.

xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=http://www.google.com --out=example.png

Its working great as expected. The only problem is what if the page can be scrolled vertically (ie. greater than 768 in height)? The screenshot will be chopped in that case. One possible solution is to take a longer height of screen (say, 2000), and then remove the white space from bottom. But that won't be an optimal solution.

Can someone suggest me a better solution?

share|improve this question
    
You could use xwininfo from the x11-utils package to find the window geometry. –  waltinator Dec 27 '11 at 0:34
    
shutter can do command line screenshots too in case you do not need to stick with cutycapt. –  Rinzwind Mar 3 '12 at 16:14
    
askubuntu.com/questions/421980/… –  Ask Feb 17 at 12:13
add comment

3 Answers

Tools for creating screenshots of webpages:

Gimp 2.8 has Create/From Webpage, very easy to use, allows configuration of page width and font size (but only a predefined selection).

shutter (requires gnome-web-photo), a GUI screenshot tool that also supports webpages, doesn't seem to have much configurability

gnome-web-photo, command line app, allows user style sheets and setting the page width

webkit-image-gtk, command line app, trivial to use, no configuration at all

webkit-image-qt, command line app, trivial to use, no configuration at all

Haven't yet found anything that allows zooming, free control over font size or limiting the screenshot to a specific div. The Gimp one can probably be automated via use of script-fu and batch mode.

share|improve this answer
    
Could you explain the use of each tool? –  Braiam Feb 20 at 3:26
add comment

Here a list of applications that you can use from terminal:

wkhtmltopdf is a command line utility that converts html to pdf using webkit rendering engine.

sudo apt-get install wkhtmltopdf

The wkhtmltoimage utility shall take the screenshot of a given url, and save it as a png image. It uses the webkit rendering engine.

Download : http://code.google.com/p/wkhtmltopdf/downloads/list

Usage :

To use the wkthmltoimage utility simple run the command from terminal, giving the url and the name for the image file.

$ ./wkhtmltoimage-amd64 http://www.google.com google.png

It will create google.png in home directory with the screenshot of www.google.com

Other options :

wkhtmltoimage provides many options to customise the screenshot. Some examples are as follows :

Quality - Controls the quality/compression of the generation image. Default is 94

$ ./wkhtmltoimage-amd64 --quality 50 http://www.google.com google.png

Disable images

$ ./wkhtmltoimage-amd64 --no-images http://www.google.com google.png

Disable javascript

$ ./wkhtmltoimage-amd64 --disable-javascript http://www.google.com google.png

Crop the screenshot

$ ./wkhtmltoimage-amd64 --crop-h 300 --crop-w 300 --crop-x 0 --crop-y 0 http://www.google.com googl

Cutycapt is a utility to take the screenshot of a url, using the webkit rendering engine and save it to an image file.

Install

sudo apt-get install subversion libqt4-webkit libqt4-dev g++ cutycapt

Usage To use cutycapt, simply run the command from the terminal, providing the url and the name for the output file.

$ cutycapt --url=http://www.google.com/ --out=google.png

It will create google.png file in home directory which would have the screenshot of www.google.com

khtml2png uses the konqueror rendering engine to create screenshots of web pages.

Download

http://khtml2png.sourceforge.net/index.php?page=download

Install

To install khtml2png, the program has to be compiled and build on the system.

sudo apt-get install kdelibs4-dev zlib1g-dev g++ cmake
Extract the khtml2png archive.
./configure
make
sudo checkinstall (this will create a deb file and install it , so that it can easily uninstalled later)

Usage To use khtml2png run the program from commandline providing the url and other options.

$ khtml2png2 --width 800 --height 600 http://www.google.com/ google.png

This would create a google.png in home directory with the screenshot of www.google.com.

Pywebshot uses python bindings embedded mozilla ( http://www.mozilla.org/unix/gtk-embedding.html )

Install

sudo apt-get install python-gtkmozembed

Download pywebshot from https://github.com/coderholic/PyWebShot

Usage :

$ python pywebshot.py www.google.com -t 1024x768&lt;br /&gt;<br />Loading www.google.com... saved as www.google.com.png

It should create a www.google.com.png in the directory which has the screenshot of size 1024 x 768.

share|improve this answer
    
Could you reduce this answer to a single tool and explain how to use it? –  Braiam Feb 20 at 3:27
add comment

If you want to take a screenshot of an webpage, then why dont you use "ScreenGrab addon" ? This addon can take fill screen screen-shots and even of selected area. Check it out here: https://addons.mozilla.org/en-US/firefox/addon/1146

share|improve this answer
    
You have to install it on Firefox browser. There is also a extension for Google Chrome/Chromium. Search for "Screen Capture" on google. –  Curious Apprentice May 9 '12 at 17:17
    
It needs to be from command line. –  Rinzwind May 9 '12 at 17:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.