Shell Scripting

Capture screenshots in Bash

Add screenshot and scrolling GIF capabilities to your Bash scripts with curl or wget. Perfect for automation, cron jobs, and DevOps workflows.

Installation

  1. 1curl is pre-installed on most Linux/macOS systems
  2. 2Get your API key from the dashboard
  3. 3Pass the X-KEY header using the -H flag

Authentication

Include your API key in the X-KEY header with every request:

#!/bin/bash
API_KEY="your-api-key"
curl "$URL" -H "X-KEY: $API_KEY" -o screenshot.png

Bash Screenshot Example

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

Screenshot
#!/bin/bash

curl -H "X-KEY: your-api-key" \
  "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png" \
  -o screenshot.png
Animation
#!/bin/bash

curl -H "X-KEY: your-api-key" \
  "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out" \
  -o animation.gif

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 (saved to file with -o)
Error ResponseError message with 4xx/5xx status

Key Features

Zero Setup

curl is pre-installed on most systems. No additional tools or browser installations required.

Production Ready

Built on Cloudflare Workers with global edge network. Perfect for cron jobs, monitoring, and automation.

Shell Integration

Works with any shell — Bash, Zsh, Fish, or sh. Perfect for scripts, Makefiles, and CI/CD pipelines.

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 anything for Bash scripts?

No. curl is pre-installed on most Linux and macOS systems. Windows 10+ includes curl by default.

Can I use this in cron jobs?

Yes. Perfect for scheduled screenshots, monitoring dashboards, or automated reporting via cron.

How do I handle errors in Bash?

Use curl's -f flag to fail silently on HTTP errors, or check the exit code. Use -w to output HTTP status codes.

Can I use wget instead of curl?

Yes. wget also works: wget --header="X-KEY: your-api-key" "$URL" -O screenshot.png

Ready to capture screenshots in Bash?

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

Start Free