Build Status


A gem to create screenshots of webpages by using the API.

You will need a (free) account to get started.


Add this line to your application's Gemfile:

gem 'screenshot_machine'

And then execute:

$ bundle

Or install it yourself as:

$ gem install screenshot_machine


Using ScreenshotMachine is quite simple

require 'screenshot_machine'

ScreenshotMachine.configure do |config|
  config.key = '012345abcdefg'

website_url = ""
sm =
# Returns a binary stream of the file

You can also config all API Parameters

require 'screenshot_machine'

ScreenshotMachine.configure do |config|
  config.key        = '012345abcdefg'
  config.size       = 'X'
  config.format     = 'PNG'
  config.cacheLimit = 2
  config.timeout    = 400


# ScreenshotMachine::Exceptions::InvalidUrl
# Raised when the website_url can not be resolved by"").screenshot
# ScreenshotMachine::Exceptions::InvalidUrl: WARNING: Invalid URL

# ScreenshotMachine::Exceptions::InvalidKey
# Raised when your API key is not set or invalid"").screenshot
# ScreenshotMachine::Exceptions::InvalidKey: ERROR: Invalid API KEY

# ScreenshotMachine::Exceptions::NoCredits
# Raised when there are not sufficient credits in your account."").screenshot
# ScreenshotMachine::Exceptions::NoCredits: ERROR: No Credits for API


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request