Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Quick answer: a Rails screenshot integration sends a target URL and capture options to a hosted screenshot API, then stores or serves the returned image (or capture URL). This keeps browser binaries and rendering work outside your Rails processes. The Ruby code below uses ScreenshotOne’s documented screenshotone gem; its option names and authentication are specific to ScreenshotOne, not Rails itself.
Choose the integration shape first
There are two fundamentally different ways to capture a page from a Rails application:
| Approach | Where the browser runs | What Rails receives | Operational responsibility |
|---|---|---|---|
| Hosted screenshot API | The provider’s service | Image bytes or a generated capture URL | API authentication, request failures, persistence and provider-specific options |
| Playwright | Your infrastructure | A locally saved image or buffer | Browser installation, process resources, navigation, sandboxing, scaling and upgrades |
A hosted API is usually the simpler fit for a controller or background job when you do not want Chromium in every application container. Playwright is a separate browser-automation choice, not an API-compatible implementation of a hosted provider.
Quick start with ScreenshotOne’s Ruby SDK
This example follows ScreenshotOne’s official Ruby guide: Ruby SDK and examples. Verify the current gem syntax and supported parameters there when upgrading.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
1. Install the provider gem
# Gemfile
gem 'screenshotone'
# shell
bundle install
2. Store the key in Rails encrypted credentials
Rails encrypts config/credentials.yml.enc. Edit it with:
bin/rails credentials:edit
Add a namespaced value, using your real key only in the editor:
screenshotone:
access_key: YOUR_SCREENSHOTONE_ACCESS_KEY
secret_key: YOUR_SCREENSHOTONE_SECRET_KEY
Read it server-side:
access_key = Rails.application.credentials.dig(:screenshotone, :access_key)
secret_key = Rails.application.credentials.dig(:screenshotone, :secret_key)
The Rails Security Guide documents encrypted credentials and stresses protecting the credentials master key. Do not commit plaintext keys, expose them to browser JavaScript, print them in logs or paste them into a client-visible URL. Your deployment must provide the master key needed to decrypt credentials.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errors3. Create a small service object
# app/services/webpage_screenshot.rb
class WebpageScreenshot
def self.call(url:, full_page: true, delay: nil, geolocation: nil)
access_key = Rails.application.credentials.dig(:screenshotone, :access_key)
secret_key = Rails.application.credentials.dig(:screenshotone, :secret_key)
raise "Missing ScreenshotOne access key" if access_key.blank?
client = ScreenshotOne::Client.new(access_key, secret_key)
options = ScreenshotOne::TakeOptions.new(
url: url,
full_page: full_page,
delay: delay,
geolocation: geolocation
)
options.validate!
# Returns image bytes. The client can also generate a take URL.
client.take(options)
end
end
The documented ScreenshotOne flow creates ScreenshotOne::Client, builds ScreenshotOne::TakeOptions, validates options, and either generates a take URL or calls client.take(options) for image data. The names above are ScreenshotOne-specific; another provider may use different classes, parameters and authentication.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
4. Call it from a controller
class ScreenshotsController < ApplicationController
def create
target = params.require(:url)
bytes = WebpageScreenshot.call(url: target, full_page: true, delay: 2)
send_data bytes,
type: "image/png",
disposition: "inline",
filename: "page.png"
rescue ScreenshotOne::Error, Net::OpenTimeout, Net::ReadTimeout => e
Rails.logger.warn("Screenshot failed: #{e.class}")
render json: { error: "Screenshot could not be captured" }, status: :bad_gateway
end
end
In production, validate and allow-list target URLs before making outbound requests. If users can submit arbitrary URLs, protect the job from SSRF by blocking private IP ranges, localhost, link-local addresses and internal hostnames, and by limiting redirects according to your provider’s controls.
Persisting the result instead of returning it immediately
client.take(options) gives your process image bytes. You can write those bytes to a temporary file, object storage or an Active Storage attachment according to your application’s design. Do not assume that every provider returns bytes: some flows return a generated URL that Rails can store and later fetch.
class CapturePageJob < ApplicationJob
queue_as :default
def perform(record_id, url)
bytes = WebpageScreenshot.call(url: url, full_page: true)
File.binwrite(Rails.root.join("tmp", "#{record_id}.png"), bytes)
# Replace this line with your object-storage or attachment operation.
ensure
# Remove temporary files here if you create them in a real job.
end
end
For large pages, prefer a background job and an object store rather than holding the response through a controller request. Set a finite HTTP timeout, retry only transient network failures, and make jobs idempotent so a retry does not create unwanted duplicate records.
Free tools Windows power users keep installed
One-click scans. No signup required.
Capture options are provider-specific
ScreenshotOne’s examples include full-page capture, a delay and geolocation. A different service may call these parameters something else or omit them. Confirm each default in the provider’s documentation before relying on it.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
- Full page: captures beyond the initial viewport; pages that lazy-load content may need a provider option that scrolls or waits for loading.
- Delay: waits after navigation so client-side rendering can finish; use the smallest delay that reliably produces the required state.
- Geolocation: requests location-sensitive rendering where the provider supports it.
- Output: confirm whether the response is PNG, JPEG, WebP, PDF or a URL before setting your Rails content type.
Never copy an option from one SDK into another without checking its documentation. Even “full page” can differ in handling sticky elements, lazy images and very tall documents.
Playwright instead of a hosted API
Playwright’s Page API navigates a page and captures it in a browser process you operate:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });
await browser.close();
})();
The Page API also documents clipping, image type, quality and scaling. This route gives you direct browser control, but your team must package compatible browser binaries, allocate CPU and memory, handle sandboxing, and scale concurrent browser work. The reviewed documentation does not establish a common performance, reliability or price benchmark between Playwright and hosted APIs, so choose based on operational ownership and the rendering controls you need.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteOr skip the browser setup
ScreenshotNeo is a hosted screenshot API and MCP server. One GET request can return PNG, JPEG, WebP or PDF. Its clean-capture steps accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.
Ruby request from Rails
require "net/http"
require "uri"
uri = URI("https://api.screenshotneo.com/v1/shot")
uri.query = URI.encode_www_form(
access_key: Rails.application.credentials.dig(:screenshotneo, :access_key),
url: "https://stripe.com"
)
response = Net::HTTP.get_response(uri)
raise "ScreenshotNeo returned #{response.code}" unless response.is_a?(Net::HTTPSuccess)
File.binwrite("shot.webp", response.body)
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' }); const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the ScreenshotNeo documentation for request options. It supports full-page captures with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper settings and page ranges, HTML/CSS-to-image, custom CSS and JavaScript, clicks, waits, blocked ads/trackers/requests/resource types, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, selectable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Common parameter names from other screenshot APIs also work to ease migration.
| Plan | Included shots | Price |
|---|---|---|
| Free | 1,000/month | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Yearly billing gives two months free, and every feature is on every plan. The MCP server supplies take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Start with 1,000 free screenshots a month without a card.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Troubleshooting and production checks
Missing or rejected credentials
Check the encrypted-credentials namespace, deployment master key and environment-specific credentials. Rotate a leaked key and remove it from logs and source history.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Blank or incomplete capture
Increase a post-navigation delay, wait for a selector or network idle where supported, and confirm that the target is reachable without an interactive login. Full-page output does not guarantee that every lazy-loaded component has rendered.
Timeouts and transient network errors
Use bounded timeouts, queue long captures, retry only idempotent transient failures with backoff, and record the provider request identifier if one is returned. Do not retry invalid URLs indefinitely.
Unexpected dimensions or format
Set viewport, device scale, output type and quality explicitly, then map the response’s content type to your storage metadata. Provider defaults are not interchangeable.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Unsafe user-supplied URLs
Validate schemes, resolve DNS safely, block private networks and cap redirects and response sizes. Treat screenshot fetching as an outbound-request feature with the same SSRF controls as any URL previewer.
Recommended Free Tools
Deployment checklist
- Keep API keys in Rails encrypted credentials or an equivalent server-side secret store.
- Use a service object and background job for captures that may exceed a web request timeout.
- Validate target URLs and enforce SSRF protections.
- Set explicit viewport, format, full-page and wait behavior.
- Handle image bytes versus generated URLs deliberately.
- Log status and timing without logging credentials or sensitive page contents.
- Test authenticated pages, consent banners, lazy images, redirects and failure responses before production rollout.
Frequently Asked Questions
Can a Rails controller call a screenshot API directly?
Yes, but use a background job for slow or large captures and return a status or stored result instead of holding a browser-sized response open.
Does the ScreenshotOne gem work with every screenshot provider?
No. The gem, client classes and option names shown are ScreenshotOne-specific. Other services may provide a REST API or a different Ruby SDK.
When should I choose Playwright?
Choose Playwright when your team wants to operate the browser and needs its Page API controls; choose a hosted API when you prefer managed browser infrastructure.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

