Capture screenshots in Haskell
Add screenshot and scrolling GIF capabilities to your Haskell applications with http-conduit. Type-safe, pure functional, no headless browsers to manage.
Installation
- 1Add http-conduit to package.yaml or cabal file
- 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 Network.HTTP.Simple
let request = setRequestHeader "X-KEY" ["your-api-key"]
$ parseRequest_ url
response <- httpBS requestHaskell Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Simple
import qualified Data.ByteString.Lazy as BL
main :: IO ()
main = do
let request = setRequestHeader "X-KEY" ["your-api-key"]
$ parseRequest_ "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"
response <- httpLBS request
BL.writeFile "screenshot.png" (getResponseBody response){-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Simple
import qualified Data.ByteString.Lazy as BL
main :: IO ()
main = do
let request = setRequestHeader "X-KEY" ["your-api-key"]
$ parseRequest_ "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"
response <- httpLBS request
BL.writeFile "animation.gif" (getResponseBody 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 (ByteString) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
No need to install webdriver bindings. Just use http-conduit for type-safe HTTP calls.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Haskell Integration
Type-safe with IO monad. Integrates seamlessly with Yesod, Servant, Scotty, or any Haskell 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 Haskell?
No. Scrnpix runs browsers on our infrastructure. You only need http-conduit to make HTTP calls.
Can I use this with Yesod or Servant?
Yes. Scrnpix works with any Haskell environment — Yesod, Servant, Scotty, or plain Haskell applications.
How do I handle errors in Haskell?
Check the response status code with getResponseStatusCode. A 200 status means success. Use Either or ExceptT for error handling.
What GHC version is required?
GHC 8.10+ with http-conduit support. The API is a simple HTTP GET request.
Ready to capture screenshots in Haskell?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free