Capture screenshots in Clojure
Add screenshot and scrolling GIF capabilities to your Clojure applications with clj-http. Immutable, functional, no headless browsers to manage.
Installation
- 1Add clj-http to deps.edn: clj-http/clj-http {:mvn/version "3.12.3"}
- 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:
(require '[clj-http.client :as client])
(client/get url
{:headers {"X-KEY" "your-api-key"}
:as :byte-array})Clojure Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
(require '[clj-http.client :as client])
(require '[clojure.java.io :as io])
(let [response (client/get
"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"
{:headers {"X-KEY" "your-api-key"}
:as :byte-array})]
(io/copy (:body response) (io/file "screenshot.png")))(require '[clj-http.client :as client])
(require '[clojure.java.io :as io])
(let [response (client/get
"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"
{:headers {"X-KEY" "your-api-key"}
:as :byte-array})]
(io/copy (:body response) (io/file "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 (byte-array) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
No need to install Etaoin or manage browser processes. Just use clj-http for HTTP calls.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Clojure Integration
Immutable data with maps. Integrates seamlessly with Ring, Compojure, Pedestal, or any Clojure 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 Clojure?
No. Scrnpix runs browsers on our infrastructure. You only need clj-http to make HTTP calls.
Can I use this with Ring or Compojure?
Yes. Scrnpix works with any Clojure environment — Ring, Compojure, Pedestal, or plain Clojure applications.
How do I handle errors in Clojure?
Check the :status key in the response map. A 200 status means success with image bytes in :body. Use try-catch for exception handling.
What Clojure version is required?
Clojure 1.10+ with clj-http support. The API is a simple HTTP GET request.
Ready to capture screenshots in Clojure?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free