A little web service that takes the URL of a web page and returns a URL to an image of that page
Ruby JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


  __|   __|  _ \  __|  __|   \ |   __|  |  |   _ \   _ \ __ __| __|  _ \
\__ \  (       /  _|   _|   .  | \__ \  __ |  (   | (   |   |   _|     /
____/ \___| _|_\ ___| ___| _|\_| ____/ _| _| \___/ \___/   _|  ___| _|_\


A little web service that takes the URL of a web page and returns a URL to an image of that page.

We use this to create PNGs of SVGs served by our Rails apps and to make up-to-date images of Raphael graphics for sharing on Facebook and Twitter.


Getting Started

Create screenshooter.yml from screenshooter.sample.yml and add your S3 credentials.

Start the server:

ruby -rubygems screenshooter.rb

From any machine, shoot a URL:

curl "http://localhost:4567/?url=http://tycho.usno.navy.mil/cgi-bin/timer.pl"
curl "http://localhost:4567/?url=http://raphaeljs.com/tiger.html"

And the images show up at:


  • url: The url you would like to generate an image from.
  • clip: Area of the page to display. Consists of 4 integers (left, top, width, height) to be passed to clipRect.
    • example: 0,0,1000,600
  • resizewidth and resizeheight: Resize the generated image to the specified size (via ImageMagick) before uploading. If only a width is supplied, the height is scaled proportionally.
  • hb: Hashbang to add to the url.
    • example: hb=#!smoothing=less
  • callback: Wrap the response in the specified function name for use with jsonp.
  • timestamp: If set to true, a version of the file with a timestamp added to the filename will also be uploaded to s3 (in addition to a version without the timestamp). Useful for maintaining historic images of an url or generating unique image files. The base image (without the timestamp appended) will always be the most recent screenshot.
  • cachetime: Adds a Cache-Control header to the uploaded s3 file.
    • example: cachetime=600 adds Cache-Control: public, max-age=600 to the uploaded s3 file

Domain Filtering

By default, screenshooter can create images of urls on any domain. If you would like to whitelist specific domains (useful for making sure nobody misuses your instance of screenshooter), add them to screenshooter.yml. Entries are made in Ruby regex format.



Copyright (c) 2012 The Huffington Post. See LICENSE for details.