Capture screenshots with AWK
Add screenshot and scrolling GIF capabilities to your AWK workflows by combining with curl. Perfect for Unix pipelines and text processing automation.
Installation
- 1AWK and curl are pre-installed on most Unix systems
- 2Get your API key from the dashboard
- 3Use system() or pipe to curl for HTTP requests
Authentication
Include your API key in the X-KEY header with every request:
#!/usr/bin/awk -f
BEGIN {
url = "https://api.scrnpix.com/screenshot?url=..."
cmd = "curl -s -H 'X-KEY: your-api-key' '" url "' -o screenshot.png"
system(cmd)
}AWK Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
BEGIN {
cmd = "curl -s -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"
system(cmd)
}BEGIN {
cmd = "curl -s -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"
system(cmd)
}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 (via curl -o) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
AWK and curl are pre-installed on most Unix systems. No additional tools required.
Production Ready
Built on Cloudflare Workers with global edge network. Perfect for cron jobs and automation pipelines.
Unix Integration
Combine with grep, sed, and other Unix tools. Process URLs from files and capture screenshots in batch.
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?
No. AWK and curl are pre-installed on most Linux and macOS systems. Just combine them with pipes or system().
Can I process multiple URLs from a file?
Yes. Read URLs from a file with AWK, construct the API URL, and call curl for each using system() or getline.
How do I handle errors in AWK?
Check the return value of system() call. Use curl's -f flag to fail on HTTP errors.
Which AWK version should I use?
GNU AWK (gawk) is recommended for system() support. The API is a simple HTTP GET via curl.
Ready to capture screenshots with AWK?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free