Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The quickest command-line screenshot depends on where you want rendering to happen. Use Playwright CLI or shot-scraper when you want a browser running in your own machine or CI worker. Use a hosted REST API when you prefer one authenticated HTTP request and no browser installation. For a hosted service, ScreenshotNeo is the first option to try: it removes common consent banners, popups and chat widgets before capture, bills only clean shots, and has a free monthly tier.

Choose the capture route first

Route Where the browser runs Best fit Main trade-off
Playwright CLI Your workstation or CI runner Local, reproducible browser automation You install and maintain browser dependencies
shot-scraper Your Python environment Python-oriented scripts and scheduled jobs Still requires a local Playwright browser setup
Hosted REST API The provider’s infrastructure Shell scripts that should make an HTTP call You manage an API key and service response handling

A viewport screenshot is not the same as a full-page capture. Unless you explicitly request full-page behavior, content below the fold can be missing. Decide the output format before integrating the command: PNG is lossless, JPEG is smaller for photographic pages, WebP can reduce size when your downstream tools support it, and PDF is useful for document-style output.

Option 1: Playwright CLI on your machine

Playwright’s official CLI workflow installs through npm, opens a URL, and writes a screenshot file. It is a good default when your CI image can install Node.js and browser binaries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install and capture a viewport

npm install -g @playwright/cli@latest
playwright-cli open https://example.com
playwright-cli screenshot --filename=example.png

The first command installs the CLI globally. The open command starts a browser session at the target URL. The screenshot command captures the current viewport and saves it as example.png.

Capture the entire page

playwright-cli screenshot --full-page --filename=example-full.png

--full-page expands the capture to the page’s full scrollable height. This is the switch to use for documentation snapshots and visual-regression artifacts where below-the-fold content matters.

Select format, resolution, and an element

playwright-cli screenshot --type=jpeg --filename=example.jpg
playwright-cli screenshot --type=webp --filename=example.webp
playwright-cli screenshot --hires --filename=example-hires.png

The documented type values are PNG, JPEG, and WebP. The --hires option requests a higher-resolution capture. The CLI can also capture a specific element rather than the whole viewport; target the element with the selector supported by your installed CLI version, then keep the selector stable in your application markup.

Programmatic equivalent

If a shell command is no longer enough, the Page API exposes the same browser engine:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({ path: 'screenshot.png' });

The Page API documents fullPage, quality, and scale options. Use quality for JPEG output; it has no effect on lossless PNG. Treat scale and high-resolution settings as output-size decisions because larger bitmaps consume more storage and CI bandwidth.

Option 2: shot-scraper for Python pipelines

shot-scraper is a command-line utility built on Playwright and installed with pip. It fits teams that already package Python tools in a virtual environment or run scheduled Python jobs. A typical setup is:

python -m venv .venv
. .venv/bin/activate
pip install shot-scraper

After installation, use the utility’s URL and screenshot options for your workflow. Keep the virtual environment and browser installation in the same CI image so a scheduled run does not fail because a browser executable is missing. Pin the package in your requirements file when reproducibility matters.

Option 3: call a hosted screenshot API with curl

A hosted API removes local browser setup. Screenshot API’s documented endpoint accepts an authenticated POST with JSON:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -X POST "https://api.screenshot-api.org/api/v1/screenshot" 
  -H "Authorization: Bearer $SCREENSHOT_API_KEY" 
  -H "Content-Type: application/json" 
  -d '{"url":"https://example.com","format":"png","fullPage":false}'

Store the key in an environment variable or your CI secret store, never in a committed script. The request asks for a PNG viewport capture. Set "fullPage":true when the API’s full-page mode is required.

Authentication and request choices

The service documentation describes bearer authentication, query-parameter authentication, and an X-API-Key header. Prefer the header or bearer form that matches your secret-management conventions. It documents both GET and POST methods, PNG, JPEG, WebP, and PDF output, redirects, viewport and CSS/JavaScript controls, and a batch endpoint at /api/v1/screenshot/batch for multiple captures. Confirm the provider’s exact field names before switching methods; a valid URL alone does not guarantee that a requested option is enabled for your account.

Save bytes versus parse a response

Some hosted modes return image or PDF bytes directly; others return JSON or a CDN location. If your response is binary, redirect it to a file:

curl -f -X POST "https://api.screenshot-api.org/api/v1/screenshot" 
  -H "Authorization: Bearer $SCREENSHOT_API_KEY" 
  -H "Content-Type: application/json" 
  -d '{"url":"https://example.com","format":"webp","fullPage":true}' 
  -o example.webp

-f makes curl fail on HTTP errors instead of quietly writing an error document as an image. If the selected API mode returns JSON, save the JSON separately and download the documented image or PDF URL in a second step.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ScreenshotNeo: skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. It is the first hosted option to try when you want clean captures: before rendering, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets. Each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

Its API is a GET request. The following call returns a WebP screenshot of Stripe:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for the complete parameter list and response behavior.

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Options for production captures

ScreenshotNeo documents 63 options, including full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets and custom viewports, retina scale, PDF paper size and margins, page ranges, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits for a selector, delay or network idle, ad/tracker/request/resource blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed links for public image tags, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

MCP for AI agents

The MCP server exposes take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. That lets an agent request a capture or page inspection without you writing a browser script.

Plans and billing

Plan Allowance Price
Free 1,000 shots/month $0; no card
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

Make command-line captures reliable in CI

Keep credentials out of logs

  • Define API keys as masked CI secrets and expose them only as environment variables.
  • Do not echo complete URLs when they contain tokens, signed parameters, or private identifiers.
  • Write output files to an artifact directory and expire artifacts according to your team’s policy.

Control timing and page state

  • Use an explicit wait for a selector, a fixed delay, or network-idle behavior when content is rendered asynchronously.
  • Use full-page mode only when the complete document is required; it takes longer and produces larger files.
  • For lazy-loaded images, choose a tool or option that scrolls and loads them before capture.

Make output deterministic

  • Set a fixed viewport, device scale, timezone, locale, and user agent when visual diffs must be stable.
  • Block ads, trackers, or third-party resources that create changing pixels, but verify that blocking does not remove content you intend to test.
  • Use a consistent format and filename convention, such as site-commit-sha.webp.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The command is not found

For Playwright, verify that npm’s global binary directory is on PATH. For shot-scraper, activate the virtual environment containing the package. In CI, print the tool version and fail early if installation did not complete.

The screenshot is only the visible viewport

Add Playwright’s --full-page option or set the hosted API’s full-page field. A long page may still need a wait for lazy content before capture.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The file is actually an error message

Use curl’s -f flag, inspect the HTTP status and content type, and check authentication. Hosted APIs may return JSON describing an error even when your output filename ends in .png or .webp.

Images or fonts are missing

Wait for the relevant selector or network idle, allow required resource types, and check whether ad or tracker blocking removed a dependency. Private pages may require cookies, custom headers, or an Authorization header.

A page shows a bot check or blank result

A local browser will expose the page’s challenge and should be handled according to the site’s access rules. ScreenshotNeo identifies bot checks, blank pages, timeouts and failed loads in response headers and does not bill those failed captures.

Which approach should you use?

  • Choose Playwright CLI when browser execution must remain inside your controlled runner and you need interactive automation.
  • Choose shot-scraper when your pipeline is already Python-centric and a local command is preferable.
  • Choose a hosted API when a single HTTP request, provider-managed browsers, or bulk jobs matter more than local control.
  • Choose ScreenshotNeo first among hosted options when clean shots, non-billed failed loads, MCP access, and a $5 paid entry plan are important.

Frequently Asked Questions

Can I capture a PDF instead of an image from the command line?

Yes. Hosted services documented for this workflow can return PDF output; ScreenshotNeo exposes PDF capture through its API and MCP tool, with paper size, margins, landscape, and page-range controls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I use GET or POST for a hosted screenshot API?

Use the method supported by your provider and keep secrets out of URLs when possible. Screenshot API documents both GET and POST; ScreenshotNeo’s supplied example uses GET with an access key and URL.

How do I capture many URLs?

Use a provider’s batch endpoint when available. Screenshot API documents /api/v1/screenshot/batch; ScreenshotNeo supports bulk capture of up to 100 URLs per call.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.