Optimizing Screenshot API Performance: From 5s to 1.5s
Speed matters. Here's how to get the fastest screenshots from our API.
## 1. Choose the Right Wait Strategy
load(default): Waits for page load event — fastest, works for most sitesdomcontentloaded: Even faster, but may miss lazy-loaded contentnetworkidle: Slowest but most complete — use for SPAs
## 2. Format Matters
| Format | Size | Speed | Quality | |--------|------|-------|---------| | WebP | Smallest | Fastest | Good | | JPEG | Small | Fast | Good | | PNG | Largest | Slowest | Lossless |
Use WebP with quality 75 for the best size/speed/quality balance.
## 3. Viewport Size
Smaller viewports render faster. If you only need a thumbnail, use mobile viewport (375x667) instead of desktop.
## 4. Block Unnecessary Content
`json
{
"url": "https://example.com",
"blockAds": true,
"blockCookies": true,
"format": "webp",
"quality": 75
}
`
Blocking ads and cookie banners can reduce render time by 30-40%.
## 5. Use Base64 for Inline Display
Add ?base64=true to skip file handling and get the image data directly in your JSON response.