Capture screenshots in Nim
Add screenshot and scrolling GIF capabilities to your Nim applications with std/httpclient. Efficient, expressive, no headless browsers to manage.
Installation
- 1std/httpclient is included in Nim standard library
- 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:
import std/httpclient
var client = newHttpClient()
client.headers = newHttpHeaders({"X-KEY": "your-api-key"})
let response = client.getContent(url)Nim Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
import httpclient
var client = newHttpClient()
client.headers = newHttpHeaders({"X-KEY": "your-api-key"})
let response = client.getContent(
"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"
)
writeFile("screenshot.png", response)import httpclient
var client = newHttpClient()
client.headers = newHttpHeaders({"X-KEY": "your-api-key"})
let response = client.getContent(
"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"
)
writeFile("animation.gif", response)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
std/httpclient is built into Nim. No external dependencies or browser installations required.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Nim Integration
Compile to C for efficiency. Integrates seamlessly with Jester, Prologue, or any Nim 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 Nim?
No. Scrnpix runs browsers on our infrastructure. You only need Nim's built-in std/httpclient to make HTTP calls.
Can I use this with Jester or Prologue?
Yes. Scrnpix works with any Nim framework — Jester, Prologue, Karax, or plain Nim applications.
How do I handle errors in Nim?
Use try-except blocks to catch HttpRequestError. A 200 status means success with image bytes in the response body.
What Nim version is required?
Nim 1.6+ with std/httpclient support. The API is a simple HTTP GET request.
Ready to capture screenshots in Nim?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free