I spent way too long last quarter evaluating how to generate screenshots programmatically. Not for fun — we needed reliable page captures for a visual regression pipeline, and the number of ways to do this in 2026 is honestly overwhelming.
Here's what I tried and what I learned.
Headless Chrome via Puppeteer
The classic. Spin up a headless browser, navigate, call page.screenshot(). Works fine for simple pages.
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.screenshot({ path: 'shot.png', fullPage: true });
await browser.close();
The problems start when you need scale. Each browser instance eats ~200-400MB RAM. Cookie banners, chat widgets, lazy-loaded content — you end up writing more workaround code than actual logic. And don't get me started on managing Chrome versions in CI.
Playwright (the Puppeteer successor, kinda)
Same idea, better API. Cross-browser support is nice if you actually need it (most people dont). The waitForSelector and network interception stuff is cleaner.
But the resource problem is identical. You're still running a full browser. Had a situation where our GitHub Actions runner kept OOM-killing during parallel captures.
html2canvas / dom-to-image
Client-side rendering. No actual browser engine — it re-renders the DOM to canvas. Fast, lightweight, zero infrastructure.
Catch: it doesn't handle everything. CSS grid gaps, some transforms, web fonts that haven't loaded yet. If your pages are simple it works great. For anything production-grade with complex layouts, the output is... approximated.
Screenshot API
This is where I ended up. Offload the rendering to a service that maintains the browser infrastructure. Send a URL, get back an image.
We went with ScreenshotRun — the API handles full-page capture, blocks cookie banners and ads, supports dark mode, retina, device emulation. One HTTP call replaces about 40 lines of Puppeteer boilerplate.
curl 'https://api.screenshotrun.com/capture' \\
-d url=https://example.com \\
-d full_page=true \\
-d block_cookies=true \\
-d format=webp
The tradeoff is obvious — you're paying per screenshot instead of paying for compute. For our volume (~2000 captures/month) it was cheaper than maintaining the infra ourselves.
Which one to pick
Depends on your situation tbh:
- < 50 screenshots/month, simple pages — Puppeteer/Playwright, run it locally
- Client-side only, no server — html2canvas, accept the rendering gaps
- Production pipeline, need reliability — API service, skip the infra headache
- Massive volume, custom needs — self-hosted Playwright cluster, budget for DevOps time
The rendering engine matters less than people think. What kills most screenshot setups is the edge cases: pages that need auth, SPAs that take 8 seconds to hydrate, cookie consent dialogs covering half the viewport. Whatever approach you pick, budget time for those.
What's your setup for automated screenshots? Curious if anyone's running something completely different.
Top comments (0)