Taking Screenshot of websites via command line(with support for java/javascript)

I recently had the need to take screen from web pages via the command line, but I had a hard time finding a tool to do it. It was then that I found CutyCapt.

It basically uses Qt to open the page, load it, run the javascript (WE CAN!) and take screen.

Some features of it are:

  • Run javascript.
  • Run java.
  • Set height / width.
  • Output in various formats (png | pdf | ps | svg | png |…)
  • Configurable Delay to wait after the page load.

To run the CutyCapt you need Qt installed and an X server running.
In the case of a server that obviously does not have an X running you can use xvfb-run to resolve this problem.

Ex: Xvfb-run – server-args = “-screen 0, 1024x768x24” CutyCapt –url=… –out=…

To install it on ArchLinux just pick up in the AUR.

To compile it on Ubuntu just run the following commands.

sudo apt-get install subversion libqt4-webkit libqt4-dev g++
svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
cd cutycapt/CutyCapt
qmake
make
sudo mv CutyCapt /usr/bin/CutyCapt

Done! Now you can run it normally.

Leave a Reply