Capture screenshots in Erlang
Add screenshot and scrolling GIF capabilities to your Erlang applications with httpc or hackney. Battle-tested concurrency, no headless browsers to manage.
Installation
- 1httpc is included in OTP (inets application)
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your requests
Authentication
Include your API key in the X-KEY header with every request:
inets:start(),
ssl:start(),
{ok, {{_, 200, _}, _, Body}} = httpc:request(get,
{Url, [{"X-KEY", "your-api-key"}]},
[], [{body_format, binary}]).Erlang Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
inets:start(),
ssl:start(),
{ok, {{_, 200, _}, _, Body}} = httpc:request(get,
{"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png",
[{"X-KEY", "your-api-key"}]},
[], [{body_format, binary}]),
file:write_file("screenshot.png", Body).inets:start(),
ssl:start(),
{ok, {{_, 200, _}, _, Body}} = httpc:request(get,
{"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out",
[{"X-KEY", "your-api-key"}]},
[], [{body_format, binary}]),
file:write_file("animation.gif", Body).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 (binary) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
httpc is included in OTP. No need for external browser dependencies or complex setups.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Erlang Integration
Pattern matching with OTP. Integrates seamlessly with Cowboy, Phoenix (via Elixir), or any Erlang application.
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 Erlang?
No. Scrnpix runs browsers on our infrastructure. You only need httpc (included in OTP) to make HTTP calls.
Can I use this with Cowboy or OTP applications?
Yes. Scrnpix works with any Erlang environment — Cowboy, RabbitMQ plugins, or plain OTP applications.
How do I handle errors in Erlang?
Pattern match on the response tuple. {ok, {{_, 200, _}, _, Body}} means success. Use try-catch or supervisor trees for error handling.
What OTP version is required?
OTP 22+ with httpc support. The API is a simple HTTP GET request.
Ready to capture screenshots in Erlang?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free