Building a headless web site screenshot server

Posted by bandito at 09 Jun 2010


Debian, Ubuntu:

sudo aptitude install xvfb xfonts-base xfonts-75dpi xfonts-100dpi imagemagick ttf-mscorefonts-installer python-qt4 python-qt4 build-essential  flashplugin-installer ruby ruby1.8-dev irb rdoc redis-server git-core rubygems rake

sudo gem install sinatra json resque
sudo gem install redis -v "1.0.7"

sudo cp /usr/bin/
sudo chmod o+x /usr/bin/

git clone git://

The redis 2.0 driver doesn't currently work with resque (see )


#add a sample
#ruby sample.rb
QUEUE=* rake resque:work
rescue-web #optional

#run the webserver
ruby server.rb

wget http://localhost:4567/schedule?url=

The last statement will return a json string with the uid of the job and the location of the filename.


When the screenshot is taken you will recieve a callback with the screenshots location as a parameter (as well as the id).

Code & Read More

comments powered by Disqus