# Shotfly vs self-hosted Playwright

> Run your own Playwright screenshot service or call an API? What self-hosting involves, what it costs to run, and when each choice fits.

Self-hosted Playwright gives you full control and no per-screenshot fee, but you install, update and sandbox the browsers, protect your network from the URLs you capture, and handle cookie banners, bot challenges and blank pages yourself. Shotfly does that behind one HTTP request and doesn't charge for failed captures. Self-host for internal pages or an existing browser fleet; use an API for user-supplied URLs.

## What does a self-hosted Playwright screenshot service need?

| Part | With Playwright, you | With Shotfly |
| --- | --- | --- |
| Browser | Install the browsers and their system packages with `npx playwright install --with-deps chromium`, and run it again after each Playwright upgrade, since every version needs specific browser builds | Nothing to install |
| Containers | Build your own image: the official `mcr.microsoft.com/playwright` image is meant for testing and development, and Playwright advises against using it to visit untrusted websites | Nothing to run |
| Sandbox | Run the browser as a non-root user with a seccomp profile; as root, the Chromium sandbox is off | Handled |
| Untrusted URLs | Block private and internal addresses, at connect time and on every redirect, or a user-supplied URL can reach your network | Refused with `url_not_allowed`, including redirects during the render |
| Cookie banners | Hide or reject them: [hiding cookie banners](https://shotfly.dev/guides/screenshots-without-cookie-banners) | `block_cookie_banners`, on by default |
| Bot challenges | Detect them before saving: [detecting bot challenges](https://shotfly.dev/guides/detect-bot-challenge-pages) | `target_blocked`, not charged |
| Blank pages | Wait for content and check the pixels: [fixing blank screenshots](https://shotfly.dev/guides/fix-blank-screenshots) | `blank_page`, not charged |
| Lazy content | Scroll before a full-page capture: [full-page captures of lazy pages](https://shotfly.dev/guides/full-page-screenshots-lazy-loading) | `full_page=true` scrolls first |
| Storage and caching | Store, cache and serve the images; sign links you embed | `cache_ttl`, one-hour links, signed URLs |
| Scaling | Size servers for concurrent browsers, restart crashed ones, queue the overflow | Concurrency per plan (2 to 25) and async jobs |

Two more notes from Playwright's Docker documentation: start containers with `--init` to avoid zombie processes, and with `--ipc=host`, without which Chromium can run out of memory and crash. Alpine images are not supported.

## What does the smallest version look like?

Playwright:

```js
import { chromium } from 'playwright'

// One URL in, one PNG out. Everything in the table above is still left to build.
const url = process.argv[2]
const browser = await chromium.launch()
try {
  const page = await browser.newPage({ viewport: { width: 1280, height: 800 } })
  await page.goto(url, { waitUntil: 'load', timeout: 30_000 })
  await page.screenshot({ path: 'screenshot.png', fullPage: true })
} finally {
  await browser.close()
}
```

Shotfly:

```js
import { writeFile } from 'node:fs/promises'

const params = new URLSearchParams({ url: process.argv[2], full_page: 'true' })
const res = await fetch(`https://api.shotfly.dev/v1/screenshot?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SHOTFLY_SECRET_KEY}` },
})
if (!res.ok) throw new Error((await res.json()).error.message) // failures cost nothing
await writeFile('screenshot.png', Buffer.from(await res.arrayBuffer()))
```

The Playwright version captures one page. It doesn't yet check where the URL points, survive a hung page, remove banners, or notice that it saved a challenge page.

## What does self-hosting Playwright cost?

Playwright is free; running it as a service is not. Shotfly has found no authoritative public figure for that cost, because it depends on your volume, your cloud and your team, so this page doesn't invent one. Price these yourself:

- **Servers.** Each concurrent browser needs its own memory and CPU, plus headroom for heavy pages and for restarts after crashes.
- **Engineering time.** Browser and library upgrades, container images, incidents, and the quality work in the table above.
- **Proxies,** if sites start blocking your server addresses.
- **Storage and delivery** for the images, if you serve them to users.

On the Shotfly side, the price is the plan. Failed renders, bot challenges, blank pages and cache hits are not charged.

| Shotfly plan | Price | Screenshots a month | Per 1,000 |
| --- | --- | --- | --- |
| Free | $0 | 100 | Free |
| Starter | $9 / month | 2,000 | $4.50 |
| Growth | $29 / month | 10,000 | $2.90 |
| Pro | $99 / month | 50,000 | $1.98 |

## When is self-hosting Playwright the better choice?

- You capture pages on your own network, such as internal dashboards. Shotfly only renders public addresses.
- You already run Playwright in production for other work, so the browser fleet and its upkeep exist anyway.
- You need browser features an API doesn't expose, such as extensions, long scripted sessions or a fixed browser build.
- Your volume is large and steady enough that the engineering time pays for itself, or third-party processing is not an option.

## When is an API the better choice?

- The URLs come from your users. Then every capture is an outbound request to an address someone else chose, and the network protection has to be right.
- You need clean results from third-party sites: cookie banners gone, bot challenges and blank pages caught instead of stored.
- Screenshots are a feature of your product, not the product, and nobody on the team wants to be on call for a browser fleet.
- Your volume is small or uneven, so paying per screenshot costs less than keeping servers running.

## How do Playwright options map to Shotfly parameters?

| Playwright | Shotfly |
| --- | --- |
| `browser.newPage({ viewport, deviceScaleFactor })` | `viewport_width`, `viewport_height`, `device_scale_factor` |
| `devices["iPhone 15"]` | `device=iphone_15` |
| `browser.newPage({ colorScheme: "dark" })` | `dark_mode=true` |
| `page.screenshot({ fullPage: true })` | `full_page=true` |
| `page.screenshot({ type, quality })` | `format`, `quality` |
| `page.screenshot({ clip })` | `clip_x`, `clip_y`, `clip_width`, `clip_height` |
| `locator.screenshot()` | `selector` |
| `page.pdf()` | `format=pdf` |
| `page.goto(url, { waitUntil: "networkidle" })` | `wait_until=networkidle` |
| `page.waitForSelector(selector)` | `wait_for_selector` |
| `browser.newContext({ userAgent, extraHTTPHeaders })`, `context.addCookies()` | `user_agent`, `headers`, `cookies` |
| `page.addStyleTag()`, `page.evaluate()` | `css`, `js` |

Sources: [playwright.dev browsers](https://playwright.dev/docs/browsers), [playwright.dev Docker](https://playwright.dev/docs/docker), read 2026-12-01. Playwright is an open-source project; Shotfly is not affiliated with it.

---

Source: https://shotfly.dev/compare/playwright · Last updated 2026-12-01
