[olug] automating web page screenshots

Adam Haeder adam at adamhaeder.com
Wed Mar 13 21:16:02 UTC 2013


Automating the creation of webpage screenshots used to be a giant thorn in
my side. I just stumbled across this project on github today that makes it
pretty simple:
http://phantomjs.org/ - PhantomJS is a headless WebKit with JavaScript API.
It has fast and native support for various web standards: DOM handling, CSS
selector, JSON, Canvas, and SVG.

Howto:
Step 1. Download the package from http://phantomjs.org/download.html.
Compiled for CentOS 5.8 so you might not even have to compile it yourself.
Step 2. Extract: tar xvjf phantomjs-1.8.2-linux-i686.tar.bz2
Step 3. Go to the examples directory: cd phantomjs-1.8.2-linux-i686/examples
Step 4. Grab a screenshot of google.com: ../bin/phantomjs ./rasterize.js "
http://www.google.com" google.png

Couldn't be easier

-- 
Adam Haeder
adam at adamhaeder.com

Check out my latest book: LPI Linux Certification in a Nutshell from
O'Reilly: http://bit.ly/bvQQ0I



More information about the OLUG mailing list