Capture screenshots in Java
Add screenshot and scrolling GIF capabilities to your Java applications with HttpClient (Java 11+). No Selenium, no headless browsers to manage.
Installation
- 1Use Java 11+ (includes HttpClient API)
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your HTTP requests
Authentication
Include your API key in the X-KEY header with every request:
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("X-KEY", "your-api-key")
.GET()
.build();Java Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
curl "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png" \ -H "X-KEY: your-api-key" \ -o screenshot.png
curl "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out" \ -H "X-KEY: your-api-key" \ -o 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[]) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
No need to install Selenium or manage headless Chrome. Just use the HttpClient included in Java 11+.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Java Integration
Modern HttpClient API. Integrates seamlessly with Spring Boot, Quarkus, Micronaut, or any Java 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 Java?
No. Scrnpix runs browsers on our infrastructure. You only need Java 11+ with HttpClient to make HTTP calls.
Can I use this with Spring Boot or Quarkus?
Yes. Scrnpix works with any Java framework — Spring Boot, Quarkus, Micronaut, or plain Java applications.
How do I handle errors in Java?
Check the response status code. A 200 status means success with image bytes in the body. 4xx errors indicate invalid params or auth issues, 5xx errors are server-side.
What Java version is required?
Java 11+ is required for HttpClient API support. The API is a simple HTTP GET request.
Ready to capture screenshots in Java?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free