Dynamic JVM

Capture screenshots in Groovy

Add screenshot and scrolling GIF capabilities to your Groovy applications with HttpBuilder. Dynamic typing, JVM power, no headless browsers to manage.

Installation

  1. 1Use @Grab for http-builder-ng or Java's URL class
  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:

def connection = new URL(url).openConnection()
connection.setRequestProperty("X-KEY", "your-api-key")
def bytes = connection.inputStream.bytes

Groovy Screenshot Example

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

Screenshot
def url = new URL("https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png")
def connection = url.openConnection()
connection.setRequestProperty("X-KEY", "your-api-key")

new File("screenshot.png").bytes = connection.inputStream.bytes
Animation
def url = new URL("https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out")
def connection = url.openConnection()
connection.setRequestProperty("X-KEY", "your-api-key")

new File("animation.gif").bytes = connection.inputStream.bytes

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 (byte[])
Error ResponseError message with 4xx/5xx status

Key Features

Zero Setup

Use Java's URL class or @Grab HttpBuilder. No Selenium or browser installations required.

Production Ready

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

Groovy Integration

Dynamic and concise syntax. Works with Gradle builds, Jenkins pipelines, Grails, or any Groovy 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 Groovy?

No. Scrnpix runs browsers on our infrastructure. You only need Java's URL class or HttpBuilder to make HTTP calls.

Can I use this with Gradle or Jenkins?

Yes. Scrnpix works with any Groovy environment — Gradle build scripts, Jenkins pipelines, Grails, or plain Groovy scripts.

How do I handle errors in Groovy?

Use try-catch blocks for error handling. Check the responseCode for HTTP status codes.

What Groovy version is required?

Groovy 3.0+ is recommended. The API is a simple HTTP GET request.

Ready to capture screenshots in Groovy?

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

Start Free