Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
JavaScript

How to Capture a Clipped Screenshot with Puppeteer

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

Use Puppeteer’s page.screenshot() method with a clip rectangle to capture just part of a rendered page. Define the crop with x, y, width, and height; add path if you want Puppeteer to save the image to a file. For a known DOM element, elementHandle.screenshot() is often simpler because Puppeteer scrolls it into view before capturing it.

Capture a rectangle with clip

Puppeteer’s official screenshot guide points to Page.screenshot() for screenshots. Its clip option takes a rectangular region, described by the same bounding-box fields: x, y, width, and height.

const screenshot = await page.screenshot({
  path: 'clip.png',
  clip: { x: 100, y: 80, width: 500, height: 300 },
});

This saves a 500-by-300 pixel image to clip.png, starting at the specified position. If your code needs to use the image rather than just write it to disk, omit path and use the returned image data. With the standard screenshot options, Puppeteer returns a Uint8Array; with encoding: 'base64', it returns a base64 string. Puppeteer screenshot guide · Screenshot options reference

Run a complete clipped-screenshot script

The following CommonJS example launches Chromium, opens a page, waits for navigation to reach the selected state, and saves a clipped screenshot. Install Puppeteer in your project first with npm install puppeteer; this example assumes the package is installed locally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });

    await page.screenshot({
      path: 'clip.png',
      clip: { x: 100, y: 80, width: 500, height: 300 },
    });
  } finally {
    await browser.close();
  }
})();

Replace the URL with the page you need and adjust the rectangle. The Puppeteer guide demonstrates navigation followed by a screenshot and uses networkidle2 in its example. That wait condition is not a universal requirement: choose a page-ready condition that fits the site, and add a more specific wait if the content you need appears after navigation.

What the coordinates mean in practice

The rectangle starts at x and y and extends for width and height. These fields define the crop, so inspect the rendered page and tune the values when the output is offset or cuts off content. The reference defines a scale option on ScreenshotClip, defaulting to 1. The documentation reviewed here does not establish a broader rule for converting coordinates across device-pixel ratios; do not assume an unverified conversion when matching a crop to a particular display or viewport.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Choose a readiness condition deliberately

A screenshot reflects the page state when capture occurs. If an image, animation, client-rendered panel, or other content has not appeared yet, wait for the relevant element or page state before taking the shot. A network-idle condition may suit pages that become quiet after loading, but it can be unsuitable for pages that keep making requests; the guide’s example should not be read as a requirement for every site.

Choose between a rectangle, an element, and a full page

Method Use it when Behavior
page.screenshot({ clip }) You need a crop with explicit coordinates and dimensions. Captures the rectangle described by x, y, width, and height.
elementHandle.screenshot() The target is a particular DOM element. Puppeteer scrolls the element into view if needed, then uses the page screenshot method. It throws if the element has been detached from the DOM.
page.screenshot({ fullPage: true }) You need the full page rather than a crop. Captures the full page; fullPage defaults to false.

The method choice changes how you identify the target. Use coordinates for a region that is not naturally one element, such as an area spanning several blocks. Use an element handle when the page structure provides a reliable selector for the exact target. Use fullPage when the required output is a full-page image rather than a clipped view. ElementHandle.screenshot() reference

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.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Capture an element without calculating a crop

const card = await page.$('.product-card');
if (!card) {
  throw new Error('Could not find .product-card');
}
await card.screenshot({ path: 'product-card.png' });

Here page.$() obtains a handle for the matching element and its screenshot method handles scrolling the target into view when necessary. If the page replaces or removes that node before capture, the handle can become detached; find the element again after the page update.

Control image format, background, and returned data

Puppeteer’s ScreenshotOptions reference documents controls for output and capture behavior. PNG is the default image type. You can specify a path to save the result; without one, the screenshot is returned rather than written to disk. quality applies to formats other than PNG, and encoding can select binary output or base64.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Option What it controls Documented behavior
path Whether to save to a file, and its filename. The type can be inferred from the file extension. Without a path, the screenshot is not saved to disk.
type Image format. Defaults to PNG.
encoding Returned representation. Defaults to binary; 'base64' selects the base64 string overload.
quality Image quality for supported non-PNG formats. Does not apply to PNG.
omitBackground Whether to hide the default white background. Defaults to false; use it when a transparent background is wanted.
fullPage Whether to capture the whole page. Defaults to false.
captureBeyondViewport Whether capture may extend beyond the viewport. Defaults to false without a clip and true when a clip is supplied.
clip.scale Scale listed on the clip interface. Defaults to 1.

Use one output mode consistently in downstream code: a saved file is convenient for local inspection, while returned bytes or base64 are useful when another part of your program uploads, transforms, or serves the screenshot. The exact byte handling depends on the selected encoding and Puppeteer version’s matching API reference. Page.screenshot() API reference

Return bytes or base64 instead of writing a file

const bytes = await page.screenshot({
  clip: { x: 100, y: 80, width: 500, height: 300 },
});
// `bytes` is the returned image data (Uint8Array with the standard overload).

const base64 = await page.screenshot({
  encoding: 'base64',
  clip: { x: 100, y: 80, width: 500, height: 300 },
});
// `base64` is a base64 string.

Troubleshoot clipped captures

  • The image is offset or cuts off the wrong area: check the crop’s x, y, width, and height against the rendered page. If the layout changes between runs, wait for the intended content and measure the rectangle from the resulting state.
  • The screenshot is blank or incomplete: make sure navigation or rendering has reached the state you intend to capture. Wait for a selector or other relevant condition rather than relying on a fixed delay where possible.
  • The selector-based capture fails after a page update: the element may have been detached. Query for the current element after the update and take a new handle.
  • The output is missing from disk: provide path if you expect a file. Without it, Puppeteer returns image data rather than saving the screenshot.
  • Transparency is absent: set omitBackground: true to hide the default white background; the documented default is false.
  • JPEG quality has no apparent effect: quality applies to formats other than PNG, so select a supported non-PNG format when quality adjustment is needed.
  • The crop extends beyond what you expected: with a supplied clip, captureBeyondViewport defaults to true. Set it explicitly if you need a different behavior, consulting the documentation for the Puppeteer version installed in your project.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Version and operational considerations

Puppeteer’s screenshot API is release-sensitive. The official references reviewed for this article are labeled versions 25.10.0 through 25.12.0. Check the documentation matching your installed package before depending on option details in production. No universal timing, performance figure, or device-pixel-ratio conversion guarantee follows from the API descriptions cited here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

For reliability, keep the capture sequence explicit: navigate, wait for the particular page state needed, acquire a current element handle if capturing an element, and then write or consume the screenshot output. On dynamic pages, consider whether the crop geometry itself changes after fonts, images, or client-side content load; a fixed rectangle only remains accurate if the layout is sufficiently stable.

Or skip the browser setup

If you need an image or PDF without managing a local Puppeteer browser, ScreenshotNeo provides a website screenshot API and MCP server. A GET request returns a screenshot in PNG, JPEG, or WebP, or a PDF. For a one-call WebP capture:

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 for request options. Cookie banners and consent overlays, newsletter popups, and chat widgets are removed before capture; those cleanup steps can each be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up free for 1,000 screenshots a month, with no card required.

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.

Frequently Asked Questions

Can I use a clipped screenshot and fullPage together?

The API reference documents both options, but the supplied documentation does not establish every interaction between them. Check the reference for the Puppeteer version installed in your project before relying on a combined configuration.

Does Puppeteer’s clip use CSS pixels or device pixels?

The reviewed official API references specify the clip fields and a scale option but do not establish a broader device-pixel-ratio conversion rule. Verify behavior against the documentation for your installed version rather than assuming a conversion.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.