Systems Language

Capture screenshots in Rust

Add screenshot and scrolling GIF capabilities to your Rust applications with reqwest. Memory-safe, zero-cost abstractions, no headless browsers to manage.

Installation

  1. 1Add reqwest to Cargo.toml: reqwest = { version = "0.11", features = ["blocking"] }
  2. 2Get your API key from the dashboard
  3. 3Set the X-KEY header in your requests

Authentication

Include your API key in the X-KEY header with every request:

let client = reqwest::blocking::Client::new();
let response = client.get(url)
    .header("X-KEY", "your-api-key")
    .send()?;

Rust Screenshot Example

Capture a screenshot or create a scrolling GIF animation with a simple GET request:

Screenshot
use reqwest::blocking::Client;
use std::fs::File;
use std::io::Write;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let response = client
        .get("https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png")
        .header("X-KEY", "your-api-key")
        .send()?;

    let bytes = response.bytes()?;
    let mut file = File::create("screenshot.png")?;
    file.write_all(&bytes)?;
    Ok(())
}
Animation
use reqwest::blocking::Client;
use std::fs::File;
use std::io::Write;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let response = client
        .get("https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out")
        .header("X-KEY", "your-api-key")
        .send()?;

    let bytes = response.bytes()?;
    let mut file = File::create("animation.gif")?;
    file.write_all(&bytes)?;
    Ok(())
}

Response Format

On success, the API returns the image binary data directly in the response body.

Status Code200 OK
Content-Typeimage/png, image/jpeg, or image/gif
BodyBinary image data (Vec<u8>)
Error ResponseError message with 4xx/5xx status

Key Features

Zero Setup

No need to compile browser bindings or manage headless Chrome. Just add reqwest to your Cargo.toml.

Production Ready

Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.

Rust Integration

Idiomatic Rust with Result types. Integrates seamlessly with Actix, Axum, Rocket, or any Rust 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 Rust?

No. Scrnpix runs browsers on our infrastructure. You only need reqwest or any HTTP client crate to make HTTP calls.

Can I use this with Actix or Axum?

Yes. Scrnpix works with any Rust framework — Actix, Axum, Rocket, Warp, or plain Rust applications.

How do I handle errors in Rust?

Check the response status code using status(). A 200 status means success with image bytes in the body. Use Rust's Result type for error handling.

What Rust version is required?

Any stable Rust version (1.56+) with reqwest support. The API is a simple HTTP GET request.

Ready to capture screenshots in Rust?

Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.

Start Free