Capture screenshots in Fortran
Add screenshot and scrolling GIF capabilities to your Fortran applications with libcurl bindings. Perfect for HPC, simulations, and scientific computing.
Installation
- 1Use fortran-curl or call libcurl via ISO_C_BINDING
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your requests
Authentication
Include your API key in the X-KEY header with every request:
use curl_interface type(c_ptr) :: curl, headers curl = curl_easy_init() headers = curl_slist_append(headers, "X-KEY: your-api-key"//c_null_char) call curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers)
Fortran Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
program screenshot
use curl
implicit none
type(c_ptr) :: curl_handle, headers
curl_handle = curl_easy_init()
headers = curl_slist_append(c_null_ptr, "X-KEY: your-api-key"//c_null_char)
call curl_easy_setopt(curl_handle, CURLOPT_URL, &
"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"//c_null_char)
call curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers)
call curl_easy_perform(curl_handle)
call curl_easy_cleanup(curl_handle)
end programprogram animate
use curl
implicit none
type(c_ptr) :: curl_handle, headers
curl_handle = curl_easy_init()
headers = curl_slist_append(c_null_ptr, "X-KEY: your-api-key"//c_null_char)
call curl_easy_setopt(curl_handle, CURLOPT_URL, &
"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"//c_null_char)
call curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers)
call curl_easy_perform(curl_handle)
call curl_easy_cleanup(curl_handle)
end programResponse 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 |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
Use fortran-curl or libcurl bindings. No browser installation required on HPC clusters.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Fortran Integration
ISO_C_BINDING for native interop. Works with gfortran, ifort, or any modern Fortran compiler.
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 browsers on HPC clusters?
No. Scrnpix runs browsers on our infrastructure. You only need HTTP client capabilities via libcurl.
Can I use this in scientific simulations?
Yes. Perfect for capturing visualization outputs, generating reports from web dashboards, or documenting simulation results.
How do I handle errors in Fortran?
Check the curl return code and HTTP response status. Use error handling with iostat or similar mechanisms.
What Fortran version is required?
Fortran 2003+ for ISO_C_BINDING support. The API is a simple HTTP GET request via libcurl.
Ready to capture screenshots in Fortran?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free