Capturing Website Screenshots With Ruby

Today I thought I’d feature this nice open source Gem that some of you might like to add to your Ruby application. It’s called GrabzIt, which is a free library that supports multiple programming languages which allows you to programmatically take screenshots of a website.

This very flexible Gem can be called from any type of Ruby application.

First, you need to create a GrabzItClient class and register an account on http://grabz.it to get your application key and application secret. You then pass them both to the constructor, and after that, that’s when you use the take_picture method to request the service to take the screenshot of the URL that is passed to it.

Here’s a sample of the code:

require 'grabzitclient'
grabzItClient = GrabzItClient.new("YOUR APPLICATION KEY", "YOUR APPLICATION SECRET")
grabzItClient.save_picture("http://www.google.com", "images/test.jpg")

To find more information on how to use this amazing library, you can head to the Ruby section of their site here, while you can download the files including the demo here.

Incoming search terms for the article:

Related Posts

Active Admin For Ruby On Rails

Nodemailer – Easy Email Sending With Node.JS

Quickly Convert Hash Into URL Query

AJAX Chat By Blueimp