How to Automate Website Screenshots With Just Curl
How to Automate Website Screenshots With Just Curl
Taking website screenshots programmatically usually means installing Puppeteer or Selenium, managing Chromium binaries, handling timeouts, and debugging headless browser quirks. For a quick automation task, that's massive overkill.
Here's the alternative: a single curl command.
The Basic Command
curl -o screenshot.png "https://hermesforge.dev/api/screenshot?url=https://example.com"
That's it. No API key required for basic usage. No npm install. No browser binary. You get back a PNG image.
Adding Options
Custom Viewport Size
curl -o wide.png "https://hermesforge.dev/api/screenshot?url=https://example.com&width=1920&height=1080"
Full Page Capture
curl -o fullpage.png "https://hermesforge.dev/api/screenshot?url=https://example.com&full_page=true"
WebP Format (Smaller Files)
curl -o screenshot.webp "https://hermesforge.dev/api/screenshot?url=https://example.com&format=webp"
WebP images are typically 49% smaller than PNG — useful when you're capturing hundreds of pages.
Wait for Dynamic Content
curl -o rendered.png "https://hermesforge.dev/api/screenshot?url=https://example.com&delay=3000"
The delay parameter waits the specified milliseconds after page load, giving JavaScript-rendered content time to appear.
Block Ads and Trackers
curl -o clean.png "https://hermesforge.dev/api/screenshot?url=https://example.com&block_ads=true"
This blocks 25+ known ad and tracking domains, giving you cleaner screenshots without cookie banners and pop-ups.
Real-World Use Cases
1. Monitor a Page for Visual Changes
#!/bin/bash
# Save daily screenshots and compare
DATE=$(date +%Y-%m-%d)
curl -s -o "/tmp/screenshots/${DATE}.png" \
"https://hermesforge.dev/api/screenshot?url=https://competitor.com&width=1440"
2. Generate Thumbnails for a Link Directory
#!/bin/bash
while IFS= read -r url; do
slug=$(echo "$url" | sed 's/[^a-zA-Z0-9]/_/g')
curl -s -o "thumbs/${slug}.webp" \
"https://hermesforge.dev/api/screenshot?url=${url}&width=800&height=600&format=webp"
sleep 1 # Be polite with rate limiting
done < urls.txt
3. CI/CD Visual Regression Check
# In your CI pipeline
curl -s -o current.png \
"https://hermesforge.dev/api/screenshot?url=https://staging.myapp.com&full_page=true"
# Compare with baseline using ImageMagick
compare -metric RMSE baseline.png current.png diff.png
4. Capture Screenshots in a Cron Job
# Crontab: capture every hour
0 * * * * curl -s -o "/var/screenshots/$(date +\%H).png" "https://hermesforge.dev/api/screenshot?url=https://status.myservice.com"
Batch Screenshots (API Key Required)
For capturing multiple URLs at once, use the batch endpoint:
curl -X POST "https://hermesforge.dev/api/screenshot/batch" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_KEY" \
-d '{
"urls": [
"https://example.com",
"https://github.com",
"https://news.ycombinator.com"
],
"width": 1280,
"format": "webp"
}'
Get a free API key at our API docs page — no credit card, just enter your email.
Why Not Just Use Puppeteer?
Puppeteer is great when you need full browser control — clicking elements, filling forms, navigating SPAs. But for straightforward screenshots:
| Curl + API | Puppeteer | |
|---|---|---|
| Setup time | 0 minutes | 10-30 minutes |
| Dependencies | curl (pre-installed) | Node.js, Chromium (~400MB) |
| Memory usage | ~0 | ~300MB per instance |
| Works in CI/CD | Yes, everywhere | Needs Chromium binary |
| Scales to 100 URLs | Add a loop | Manage concurrency |
| Maintenance | None | Browser updates, crashes |
If all you need is a screenshot, don't spin up a browser. Use the API.
Rate Limits
Without an API key: 5 requests per minute. With a free API key: 20 requests per minute. Enough for most automation tasks.
Want to try it? Copy the first curl command from this post and run it in your terminal. You'll have a screenshot in under 2 seconds.