Capture screenshots in Racket
Add screenshot and scrolling GIF capabilities to your Racket applications with net/http-easy. Batteries included, no headless browsers to manage.
Installation
- 1Install http-easy: raco pkg install http-easy
- 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:
#lang racket
(require net/http-easy)
(define response
(get url
#:headers (hash 'X-KEY "your-api-key")))
(define data (response-body response))Racket Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
#lang racket
(require net/http-easy)
(define response
(get "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"
#:headers (hash 'X-KEY "your-api-key")))
(call-with-output-file "screenshot.png"
(lambda (out) (write-bytes (response-body response) out))
#:exists 'replace)#lang racket
(require net/http-easy)
(define response
(get "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"
#:headers (hash 'X-KEY "your-api-key")))
(call-with-output-file "animation.gif"
(lambda (out) (write-bytes (response-body response) out))
#:exists 'replace)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 (bytes) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
Just install http-easy package. No browser installations required.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Racket Integration
Works with DrRacket, web-server, and any Racket application. Use 2htdp/image for display.
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?
No. Scrnpix runs browsers on our infrastructure. Just install the http-easy package with raco.
Can I use this with DrRacket?
Yes. Scrnpix works with DrRacket, command-line Racket, web-server, or any Racket environment.
How do I display the screenshot in Racket?
Use (read-bitmap) from racket/draw or 2htdp/image to convert bytes to displayable images.
What Racket version is required?
Racket 8.0+ with http-easy package. The API is a simple HTTP GET request.
Ready to capture screenshots in Racket?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free