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 shortest reliable TypeScript solution is Playwright: launch a browser, set a deliberate viewport, wait for the page, and call page.screenshot({ type: 'png' }). Give the call a path to write a file, or omit it to receive PNG bytes as a Node.js Buffer. Use fullPage: true for the complete scrollable document and a locator’s screenshot() method for one element.

Set up a TypeScript screenshot project

This guide targets a Node.js TypeScript program using Playwright. Install the package and browser binaries in your project:

npm install playwright
npx playwright install

Your TypeScript configuration should support modern ECMAScript modules or CommonJS consistently with the way you run the file. The examples use top-level await; place them in an ESM module, or wrap them in an async function.

Capture a webpage as a PNG file

This complete example fixes the viewport, waits for network activity to settle, writes a PNG, and always closes the browser:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
import { chromium } from 'playwright';

const browser = await chromium.launch();
try {
  const page = await browser.newPage({
    viewport: { width: 1440, height: 900 },
  });

  await page.goto('https://example.com', { waitUntil: 'networkidle' });

  await page.screenshot({
    path: 'page.png',
    type: 'png',
  });
} finally {
  await browser.close();
}

page.screenshot() returns a promise. PNG is the default format when no other format is inferred, but specifying type: 'png' makes the intent explicit. The resulting file is created relative to the process’s current working directory; use an absolute or project-relative path when your build runs from a different directory.

Choose the capture scope

Full-page PNG

A normal screenshot covers the current viewport. To capture the entire scrollable document, set fullPage: true:

await page.screenshot({
  path: 'full-page.png',
  fullPage: true,
  type: 'png',
});

Full-page mode is appropriate for long articles, landing pages, and invoices. It can create a very tall image, so consider whether a viewport shot or a PDF is more useful for your consumer.

One element

Use a locator when you need a card, chart, header, or invoice rather than the whole page:

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

The locator must resolve to a visible element. If a selector matches multiple nodes, make it specific or select one item explicitly. Element capture and fullPage are different modes: choose the element’s screenshot method for a component, and page screenshot with fullPage for the document.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Keep the PNG in memory

Omit path when you need to upload, hash, transform, or return the image from an API:

const pngBytes = await page.screenshot({ type: 'png' });
// pngBytes is a Node.js Buffer
await fs.promises.writeFile('copy.png', pngBytes);

Import Node’s file module if you also want to persist those bytes:

import fs from 'node:fs';

With an HTTP framework, send the buffer with a PNG content type rather than converting it to a base64 string unnecessarily.

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

Control dimensions and pixel density

The viewport determines CSS layout and the screenshot’s logical dimensions. Set it before navigation so responsive breakpoints select the intended design:

const page = await browser.newPage({
  viewport: { width: 1280, height: 800 },
});

Playwright’s scale option controls output density. scale: 'css' produces one output pixel per CSS pixel and is useful when image dimensions must remain stable. scale: 'device' uses device pixels and can produce a larger, high-DPI image. Choose one policy and keep it fixed for reproducible files.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
await page.screenshot({
  path: 'retina.png',
  type: 'png',
  scale: 'device',
});

The screenshot API also accepts a capture timeout. Set it when a stalled page should fail within a known window rather than waiting indefinitely.

Wait for the page that users actually see

waitUntil: 'networkidle' can help on pages whose important resources load after the initial response, but it is not a universal readiness test. Analytics, polling, advertisements, and WebSockets may keep a page active forever. For application pages, wait for a semantic signal such as a heading, table, or chart:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.goto('https://example.com/dashboard', {
  waitUntil: 'domcontentloaded',
});
await page.locator('[data-testid="dashboard-ready"]').waitFor();
await page.screenshot({ path: 'dashboard.png', type: 'png' });

If content appears after a known interaction, perform it before capture. A short, purposeful delay can be used for an animation or lazy component, but a selector-based wait is generally less fragile.

Make captures repeatable

Disable moving content

Animated cursors, carousels, timestamps, random recommendations, and blinking carets cause pixel differences between runs. Inject a style sheet during capture and hide or freeze the parts that are not relevant to the image:

await page.screenshot({
  path: 'stable.png',
  type: 'png',
  style: `
    *, *::before, *::after {
      animation: none !important;
      transition: none !important;
      caret-color: transparent !important;
    }
  `,
});

For visual-test baselines, generate and compare images in the same operating system, browser version, browser settings, hardware conditions, power mode, and headless configuration. Those environmental factors can change rendered pixels even when your code is identical.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Always clean up

Put browser.close() in a finally block, as in the first example. This prevents orphaned browser processes when navigation, a selector wait, or the screenshot itself throws. For a service that captures many URLs, reuse a browser process where practical, create isolated pages or contexts per job, and close each page after its job.

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

Alternative: Puppeteer in TypeScript

Puppeteer provides the same basic workflow and is a natural choice when the rest of your automation already uses it:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.screenshot({
    path: 'page.png',
    type: 'png',
    fullPage: true,
  });
} finally {
  await browser.close();
}

Puppeteer’s screenshot API can return bytes, and its encoding: 'base64' option returns a base64 string. It also supports element screenshots through an element handle. Pick Playwright when you want its documented Chromium, Firefox, and WebKit coverage, locator ergonomics, or Playwright Test’s screenshot assertions; pick Puppeteer when it best matches your existing browser-automation stack. Both produce PNG files and in-memory data.

Use screenshots in visual regression tests

Playwright Test includes expect(page).toHaveScreenshot(). PNG is the default snapshot format. Keep the test environment controlled and make the page deterministic before the assertion:

import { test, expect } from '@playwright/test';

test('home page visual baseline', async ({ page }) => {
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  await page.locator('main').waitFor();
  await expect(page).toHaveScreenshot('home.png');
});

Do not treat a changed pixel as automatically a product regression. Browser updates, operating-system rendering, font availability, hardware, power source, and headless mode can all affect pixels. Review intentional changes and regenerate baselines only in the environment your team has selected as the reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failures and fixes

Blank or partially rendered image

  • Cause: the screenshot ran before client-side content or lazy images appeared.
  • Fix: wait for a page-specific selector, scroll if the application lazy-loads on scroll, or use networkidle only when the page can reach network idle.

Navigation timeout

  • Cause: a third-party request, long poll, or unreachable resource never reaches the selected wait condition.
  • Fix: use domcontentloaded plus a readiness selector, and set an explicit navigation timeout appropriate to your workload.

Locator screenshot fails

  • Cause: the selector matches nothing, more than one unexpected element, or a hidden element.
  • Fix: confirm the selector in the page, wait for it, narrow it to one node, and make sure it is visible before calling screenshot().

Output dimensions are surprising

  • Cause: no fixed viewport, a responsive breakpoint, or device-pixel scaling.
  • Fix: set viewport explicitly and choose either scale: 'css' or scale: 'device' deliberately.

Fonts or images differ between machines

  • Cause: missing fonts, different browser/OS rendering, or resources blocked by authentication or network policy.
  • Fix: install the required fonts, use the same browser image in CI, verify credentials and resource requests, and compare only controlled environments.

Browser processes remain after errors

  • Cause: cleanup is skipped on an exception.
  • Fix: close the browser in finally; for workers, also close pages and contexts after each job.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. It accepts the cookie or consent banner like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before the capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers.

PNG capture from TypeScript can be a single HTTP call:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const png = Buffer.from(await res.arrayBuffer());

See the ScreenshotNeo documentation for authentication, response handling, and the complete option set. The same endpoint is callable from cURL:

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

Or from Python:

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

ScreenshotNeo includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper and page controls, HTML/CSS-to-image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, ad/tracker/request/resource blocking, custom headers/cookies/user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed public image links, asynchronous jobs with signed webhooks, bulk capture of 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; Growth is $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing provides two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to start.

FAQ

Can Playwright save JPEG or WebP instead of PNG?

Yes. Set type: 'jpeg' or type: 'webp' in page.screenshot(). Use PNG when lossless text and transparency matter.

Should I use a full-page screenshot for a very long page?

Only when one tall image is genuinely required. Long outputs consume more memory and may be awkward to display; capture a viewport, selected elements, or a PDF when those formats fit the use case better.

How do I upload the in-memory result?

Omit path, retain the returned Buffer, and pass it to your storage or HTTP client’s binary upload method with a Content-Type of image/png.

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

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.