Best tools to convert a URL into a PNG screenshot
Compare manual capture, Playwright, and screenshot APIs, with runnable code, setup guidance, and help choosing the right URL-to-PNG workflow.
For a one-off image, use your browser or operating system’s screenshot feature and save or export as PNG. For repeatable captures in code, use Playwright: it can navigate to a URL and save a PNG, capture the full page or a selected element, and return image bytes for further processing. If you want a managed URL-to-image endpoint, put ScreenshotNeo first on your shortlist: it removes cookie banners, popups, and chat widgets before capture, bills only clean shots, and its paid plans start at $5 for 3,000 shots. A hosted API may be unsuitable when the page is private or requires interaction, so check its limits before choosing.
Choose by the job
| Need | Start with | Why | Watch for |
|---|---|---|---|
| One image of a page already open | Browser or operating-system capture | No code or service setup | Check whether the method captures the visible viewport or the whole page, and whether it saves PNG. |
| Repeatable screenshots in a script, test, or QA process | Playwright | Control navigation and capture scope; save files or consume image bytes. | Keep browser, operating system, settings, and headless mode consistent for visual comparisons. |
| A managed URL-to-image endpoint | ScreenshotNeo first; compare service limits for your use case | One request can return an image; ScreenshotNeo also removes common page overlays and identifies billed versus non-billed outcomes. | Verify authentication, interaction support, privacy, retention, quotas, and current pricing. |
There is no evidence here for a universal winner across all capture tools. The right choice depends on whether the target is public, whether it needs interaction or login, and whether you need a one-off image or a repeatable pipeline.
1. Manual browser or operating-system capture
For occasional work, open the page and use a screenshot feature already available in your browser or operating system. Save or export to PNG if the feature offers that option. Inspect the result to confirm whether it shows just the visible viewport or the entire scrollable page. If the capture method only shows the viewport and you need the full document, use browser automation or an API that explicitly supports full-page capture.
This approach is convenient for an individual image but does not make a reliable automated pipeline by itself. Page state, viewport, scroll position, and any open banners or dialogs are determined by the current browser session.
2. Playwright: the code-driven option
Playwright is a strong fit when a screenshot belongs in a script, visual check, or QA process. Its official documentation shows browser navigation to a URL and saving a PNG. The example below uses Node.js with Chromium.
Install and save a viewport screenshot
npm init -y
npm install playwright
npx playwright install chromium
Save this as screenshot.mjs and run node screenshot.mjs https://example.com. It writes screenshot.png in the current directory.
import { chromium } from 'playwright';
const url = process.argv[2];
if (!url) {
throw new Error('Usage: node screenshot.mjs https://example.com');
}
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
await page.goto(url, { waitUntil: 'networkidle', timeout: 30_000 });
await page.screenshot({ path: 'screenshot.png', type: 'png' });
} finally {
await browser.close();
}
Playwright Page API documents navigation and screenshot options. Some sites keep network connections open, so networkidle can take too long; if that happens, wait for a meaningful selector or use a short deliberate delay after navigation instead.
Capture the whole page, an element, or bytes
Playwright’s screenshot guide documents full-page capture, locator screenshots, and returning image bytes in a buffer. Replace the screenshot call in the example with one of these:
// Entire scrollable page
await page.screenshot({ path: 'full-page.png', fullPage: true, type: 'png' });
// One element selected by CSS
await page.locator('main article').screenshot({ path: 'article.png', type: 'png' });
// Image bytes for processing or upload
const pngBytes = await page.screenshot({ type: 'png' });
For a locator capture, the selector must match an element that exists and is visible. If the page renders content after scrolling, first bring the target into view and allow its content to load. See the Playwright screenshots guide for the documented screenshot workflow.
Configure output scale and page appearance
Set the viewport when creating the page to control the CSS layout width and height. Playwright supports a screenshot scale choice of CSS pixels or device pixels; choose CSS scale for smaller, layout-oriented images and device scale when you need pixels matching the device scale. A higher pixel count increases the output size. Set the browser context’s color scheme if the page should render in dark mode, and use a consistent browser environment for repeatable visual checks.
PNG is lossless and useful for visual comparison or further editing, but it can be larger than lossy formats. Playwright supports PNG and JPEG screenshots; choose the required format explicitly when saving. If an API workflow accepts format options, check its documentation for supported formats and defaults.
3. Screenshot APIs: the managed option
A screenshot API accepts a URL and returns an image, avoiding local browser installation and lifecycle management. The ScreenshotNeo call below requests a PNG response by using the documented default endpoint behavior; use the API documentation for available parameters such as output format and capture settings. Put your key in place of YOUR_API_KEY.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://stripe.com \
-o shot.webp
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()
with open("shot.webp", "wb") as f:
f.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 request failed: ${res.status}`);
await import('node:fs/promises').then(({ writeFile }) =>
writeFile('shot.webp', Buffer.from(await res.arrayBuffer()))
);
The API examples and configuration reference are in the ScreenshotNeo documentation. The request uses a URL as input and returns image data; save the response body as a binary file, not as decoded text. The sample target is stripe.com and the output name is shot.webp, matching the supplied API examples. Consult the docs for the exact format parameter when you specifically require PNG.
Comparing hosted services
1. ScreenshotNeo — a website screenshot API and MCP server. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture, and each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers state the page verdict and billing outcome. It also supports PDF, element capture, full-page capture, custom browser settings, bulk calls, and asynchronous jobs. Its free plan includes 1,000 shots per month without a card, and paid plans start at $5 for 3,000 shots. See the API documentation.
2. URLpipe — a provider-documented example of a hosted URL-to-image API. Its page lists PNG, JPEG, and WebP, plus viewport and full-page capture. The provider says its endpoint does not support interaction before capture, private or intranet addresses, PDF output, video, or direct delivery to a customer storage bucket. Its page also states a 30-day result retention period. These restrictions and commercial details are provider claims and may change; verify its current terms, pricing, and retention before relying on them. URLpipe API details.
URLpipe’s listed use cases include visual QA, thumbnails, archives, and link previews; those are vendor-described applications, not independent performance findings. There is no hands-on benchmark in the research for this guide, so compare services against your own representative URLs and constraints.
How to choose: a practical checklist
- Decide the capture scope. Is a visible viewport enough, or do you need the entire page or a selected element?
- Check page access. Does the URL require login, cookies, custom headers, a click, or form entry? Confirm the chosen tool can supply the needed state.
- Choose output requirements. Confirm PNG support, dimensions, and whether CSS-pixel or device-pixel output is needed.
- Decide where rendering runs. A local browser keeps the page in your environment; a hosted API sends the target URL to a provider for capture. Review privacy, access restrictions, and result retention.
- Make repeatability explicit. Pin the browser version and capture settings for visual comparisons, and use the same host environment as the baseline.
- Estimate usage and limits. Check quotas, image dimensions, timing limits, billing rules, and current pricing directly with the provider.
- Try representative pages. Include a long page, a page with a consent banner, a slow page, and any authenticated or interactive case that matters to your workflow.
Reliability, performance, and cost
Reliability and visual consistency
A screenshot records a rendered page, so timing and environment affect the result. A page may still be loading images or fonts after navigation returns. In Playwright, waiting for a specific content selector is often more meaningful than assuming every site reaches a network-idle state. For regression baselines, keep the operating system, browser version, settings, hardware, and headless mode consistent. Playwright’s visual comparisons guidance warns that rendering can vary across those environments.
Performance
For local automation, browser startup and page rendering are part of the work; reusing a browser process across a batch can avoid repeated startup, while each page still needs its own navigation and capture. Full-page images and high device scale create more pixels and can take more memory and storage. For hosted APIs, end-to-end time includes the service’s queue and rendering, network transfer, and image download. The research provides no measured latency comparison, so benchmark your own page set if timing is a requirement.
Cost
Manual capture has no per-request API charge, though it costs a person’s time. Playwright is an open-source automation library, but you supply the machine or browser infrastructure and maintain the capture environment. Hosted APIs trade that setup for provider limits and pricing. ScreenshotNeo’s plans are: Free, 1,000 shots/month with no card; Starter, $5 for 3,000; Growth, $15 for 15,000; Pro, $39 for 60,000; Scale, $99 for 250,000; Business, $249 for 1,000,000. Yearly billing gives two months free; every feature is on every plan. Recheck plan terms on the product site before purchase.
Common problems and fixes
| Symptom | Likely cause | What to do |
|---|---|---|
| PNG is blank or mostly empty | Capture happened before the page’s main content rendered, or the page blocked the browser/API. | Wait for a content selector or a suitable delay; inspect the page verdict or browser errors. Check whether the target uses a bot check. |
| Navigation times out | The page is slow or holds open network requests, making a broad wait condition unsuitable. | Use a realistic timeout and wait for the content needed in the image rather than all network activity. |
| Element screenshot fails | The CSS selector matched nothing, or the element is hidden or outside a usable rendered state. | Check the selector, wait for it to appear, and ensure it is visible before capture. |
| Full-page capture misses lazy images | Images load only when their area approaches the viewport. | Use a capture mode that scrolls or otherwise loads lazy images, then inspect the resulting page. ScreenshotNeo supports full-page capture with lazy images loaded. |
| Visual test differs between machines | Browser version, operating system, settings, hardware, or headless mode differ. | Capture and compare in the same pinned environment used for the baseline. |
| API response is not an image | The request returned an error response or a page verdict instead of a successful image payload. | Check the HTTP status and response headers before writing the body to a file; read the provider’s error and verdict documentation. |
| Private URL cannot be captured by a hosted service | The service cannot access private or intranet addresses, or the URL requires credentials. | Use an authorized local browser workflow or a service that explicitly supports the required private access and authentication. |
| PNG file contains WebP data or vice versa | The filename extension does not match the requested format, or the API default differs from the assumption. | Set the format explicitly using the service’s documented option and name the file to match the response format. |
Or skip the browser setup
Use ScreenshotNeo when you want a managed screenshot request without installing and operating a browser. Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
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 API documentation, then sign up for 1,000 free screenshots a month, with no card.
FAQ
Is a URL screenshot the same as downloading the page?
No. The screenshot is a raster image of the rendered page at a particular state and size; it does not preserve the page’s links or source structure as a web document.
Can I use a screenshot as a visual regression baseline?
Yes, but keep the browser and host environment consistent and account for dynamic content such as timestamps, rotating banners, and personalized elements.
Should I use PNG or JPEG?
Use PNG when you need a lossless image or pixel comparisons. Consider JPEG when smaller files matter more than exact pixel preservation, if the capture tool supports it.
Can every screenshot API capture a logged-in page?
No. Authentication, cookies, and pre-capture interaction support vary by service. Verify those capabilities before sending a private page to a hosted provider.
Sources
- Playwright Page API: navigation and screenshot API.
- Playwright screenshots guide: full-page, element, and buffer capture.
- Playwright visual comparisons: environment variation and baseline consistency.
- URLpipe screenshot API page: provider-described formats, features, restrictions, retention, and plan information.
- ScreenshotNeo documentation: API setup and supported capture options.
