Capture screenshots in Ruby
Add screenshot and scrolling GIF capabilities to your Ruby applications with the standard net/http library. No Selenium, no headless browsers to manage.
Installation
- 1No external gems required — uses Ruby standard library
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your HTTP requests
Authentication
Include your API key in the X-KEY header with every request:
request = Net::HTTP::Get.new(uri) request['X-KEY'] = 'your-api-key'
Ruby Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
curl "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png" \ -H "X-KEY: your-api-key" \ -o screenshot.png
curl "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out" \ -H "X-KEY: your-api-key" \ -o animation.gif
Response Format
On success, the API returns the image binary data directly in the response body.
| Status Code | 200 OK |
| Content-Type | image/png, image/jpeg, or image/gif |
| Body | Binary image data (String) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
No need to install Selenium or manage headless Chrome. Just use the net/http library included with Ruby.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Ruby Integration
Simple, elegant syntax. Integrates seamlessly with Rails, Sinatra, Hanami, or any Ruby framework.
Rich Features
Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.
Frequently Asked Questions
Do I need to install any browser dependencies for Ruby?
No. Scrnpix runs browsers on our infrastructure. You only need the Ruby standard library net/http to make HTTP calls.
Can I use this with Rails or Sinatra?
Yes. Scrnpix works with any Ruby framework — Rails, Sinatra, Hanami, or plain Ruby scripts.
How do I handle errors in Ruby?
Check the response status code. A 200 status means success with image bytes in the body. 4xx errors indicate invalid params or auth issues, 5xx errors are server-side.
What Ruby version is required?
Any modern Ruby version (2.7+) with standard library support. The API is a simple HTTP GET request.
Ready to capture screenshots in Ruby?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free