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

Set the page’s layout viewport with page.setViewport({ width, height }), choose a specific screenshot rectangle with clip, or capture the entire page with fullPage: true. These controls do different jobs: viewport dimensions are in CSS pixels, while device scale affects rendering density. For a particular output file size, inspect the generated image in your installed Puppeteer and Chromium setup rather than assuming a universal CSS-to-file-pixel conversion.

Viewport, screenshot bounds, and scale are separate settings

A frequent source of confusing screenshots is treating the browser viewport and the captured image as the same rectangle. Puppeteer exposes separate controls for page emulation, capture extent, and device scale. The current API references identify Puppeteer version 25.12.0; behavior and exact raster output can depend on the Puppeteer and Chromium versions in your environment.

Viewport: the page’s emulated layout area

page.setViewport({ width, height }) sets the viewport used by the page. Puppeteer defines both values in CSS pixels, not as guaranteed output-file pixel counts. A page can respond to this viewport with responsive layouts, so changing it may alter which content is visible or how the site arranges itself. The Viewport interface documents these dimensions and the device-scale setting.

Clip: a rectangle to capture

clip: { x, y, width, height } selects a screenshot region. It controls the capture bounds; it does not set the page’s viewport or ask the page to reflow to those dimensions. The ScreenshotOptions reference documents clip and the related captureBeyondViewport option. With no clip, the documented default for captureBeyondViewport is false; when a clip is supplied, its default is true.

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.
#1 Best Overall
Arducam 5MP Camera for Raspberry Pi, 1080P HD OV5647 Camera Module V1 for Raspberry Pi5/4/3/3B+, and Other A/B Series
  • High-Definition video camera for Raspberry Pi Model A or B, B+, model 2, Raspberry Pi 3,3 B+, Pi 4, Pi 5(NOT for Pi Zero)
  • 5MPixel sensor with Omnivision OV5647 sensor in a fixed-focus lens. Software auto focus lens: B07SN8GYGD
  • Integral IR filter
  • Still picture resolution: 2592 x 1944; Max video resolution: 1080p
  • Check ASIN: B07RWCGX5K for OV5647 with acrylic case. Other optional accessories: ABS case (B09TNG4V55); Mini tripod case kit (B09TKYXZFG).

Full page: capture the page’s full extent

fullPage: true asks Puppeteer to capture the full page, rather than only the viewport. It changes the capture extent, not the emulated viewport’s width and height. The option defaults to false, according to the ScreenshotOptions interface. If you need a full-page image at a particular layout width, set the viewport width first and then request the full-page capture.

Device scale: rendering density

deviceScaleFactor configures device scaling and defaults to 1. It is separate from the CSS-pixel width and height. Do not assume a particular formula will give the final file’s raster dimensions across all configurations: check the generated file when exact dimensions matter.

Goal Control What it changes
Set page layout or emulation dimensions page.setViewport({ width, height }) Viewport width and height in CSS pixels; device scale is separate. Puppeteer Viewport
Capture a particular rectangle page.screenshot({ clip: { x, y, width, height } }) Capture bounds, rather than the viewport’s layout dimensions. ScreenshotOptions
Capture the entire page page.screenshot({ fullPage: true }) Capture extent; it does not redefine the viewport. ScreenshotOptions
Resize the browser content area page.resize({ contentWidth, contentHeight }) Content-area resizing rather than viewport emulation; the method is labelled experimental. Window management

Runnable Puppeteer example for viewport, clip, and full-page output

Use this JavaScript example when you want three separate files from one page: a viewport screenshot, a clipped rectangle, and a full-page screenshot. It sets the viewport before navigation so the site loads at the intended layout size. Save it as capture.mjs in a project where Puppeteer is installed, then run node capture.mjs. Replace the example URL with the page you need.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();

  await page.setViewport({
    width: 1200,
    height: 800,
    deviceScaleFactor: 1,
  });

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

  // The visible viewport at the configured layout dimensions.
  await page.screenshot({ path: 'viewport.png' });

  // A capture rectangle: x and y mark its position on the page.
  await page.screenshot({
    path: 'region.png',
    clip: { x: 0, y: 0, width: 800, height: 500 },
  });

  // The complete page extent at the configured layout width.
  await page.screenshot({ path: 'full-page.png', fullPage: true });
} finally {
  await browser.close();
}

The calls are alternatives for different output needs, not settings to combine indiscriminately. For a region that extends beyond the viewport, specify captureBeyondViewport: true alongside clip to make that intent explicit. When you provide a clip, Puppeteer’s documented default is already true, but an explicit value makes the code easier to understand when revisited.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Arducam for Raspberry Pi HQ Camera Module,12.3MP IMX477 Raspberry Pi Camera for Raspberry Pi5/4B/3B+/Zero 2W, Comes with C-CS Adapter and Tripod Mount
  • How to use: Before using this hq camera, please modify the config.txt file by adding dtoverlay=IMX477 (If connect to cam0 port on Pi5, add dtoverlay=IMX477,cam0);
  • For all Raspberry Pi: This Arducam for Raspberry Pi camera is compatible with all Raspberry Pi;
  • What you will get: 1 x Pi hq camera(with a 1/4" tripod adapter), 1 x dust cover, 1 x C-CS adapter, 1 x 15-22pin Pi camera cable, 1 x 15-15pin Pi camera cable;
  • High resolution: This camera module can offer high-resolution images with its 12.3MP IMX477 sensor, the max resolution is 4056*3040 pixels.
  • Wide Application: This RPI camera can be used as a 3D printer camera, or home security monitor and can serve for Artificial Intelligence, like facial recognition, high-speed capturing, and so on.

For example, change the clip to { x: 100, y: 200, width: 600, height: 400 } to capture a rectangle offset from the page origin. Keep the requested width and height positive and make sure the clip describes the page region you intend; it is not a way to resize the browser window.

Or skip the browser setup

If you need a screenshot through an API rather than maintaining a local Puppeteer browser, ScreenshotNeo accepts one GET request with a URL and returns a PNG, JPEG, WebP, or PDF. Its viewport and retina-scale options cover common dimension needs. See the ScreenshotNeo documentation for request options and response details.

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

ScreenshotNeo accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots, and every feature is on every plan.

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

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

Choose the right dimension control for your output

For a fixed-size viewport screenshot

Set both width and height in setViewport, then call screenshot() without fullPage or clip. This captures the viewport. If the page is responsive, the chosen width can change its layout, so consider the viewport a page-emulation input as well as a visible-area setting.

Rank #3
Arducam for Raspberry Pi Camera Module V2-8 Megapixel,1080p IMX219 Raspberry Pi 5 Camera
  • What Will You Get: An 8mp Arducam for Raspberry Pi camera V2 with a 15cm original FFC cable for model A and B and a 15cm FPC cable for pi zero & w.
  • Sensor: 8 megapixel IMX219, Max. resolution: 3280 (H) x 2464 (V)
  • Frame Rates: 1080p47, 1640 × 1232p41 and 640 × 480p206
  • Recommended Power Supply: DC 5V, above 1.8A
  • Typical Usage Scenarios: this tiny camera board can be used for monitoring Octoprint 3D Printer, Home security and surveillance, dashcam or other machine vision application. Please search ASIN: B09TNG4V55/B09TKYXZFG to get Arducam for Raspberry Pi Camera ABS Case and Tripod Case Kit.

For an exact region within a larger page

Use clip with the rectangle’s position and dimensions. The viewport can remain at the size needed for the site’s layout while the clip selects a smaller area to save. Puppeteer’s v7.0.0 changelog records a historical change: screenshots with a clip use the clip dimensions rather than being cut by the viewport. Treat that as release context, not a guarantee that every current browser configuration produces identical file pixels; see the Puppeteer changelog and verify your result.

For a long page

Use fullPage: true when you need the full page rather than a viewport-sized capture. Set the viewport width before the capture if the page’s responsive layout matters. Full-page capture changes how much page is captured; it is not equivalent to increasing the viewport height.

For browser content-area resizing

If your goal is to resize the browser’s content area itself, Puppeteer documents Page.resize with contentWidth and contentHeight. The API reference labels it experimental, so prefer viewport emulation unless content-area resizing specifically fits your case. The Window management guide covers this option.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the output when pixel dimensions must be exact

The viewport interface defines dimensions in CSS pixels, and the device-scale factor is a distinct setting. Those facts alone do not establish a universal formula for the dimensions of every resulting PNG, JPEG, or WebP file. Puppeteer and Chromium versions and the chosen capture options matter. Open the output in an image viewer or inspect its file metadata, then compare the actual dimensions with your requirement. If they differ, confirm that you changed the intended control: viewport for layout, clip for the captured rectangle, full-page for extent, or device scale for density.

Rank #4
Arducam for Raspberry Pi Zero Camera Module, 5MP OV5647 1080P Webcam on Raspbian (Cables in 2 Kinds)
  • Pi compatible - Work natively with all Raspberry Pi models for your new project or drop-in replacement
  • Both cables - 2 cables included so you can switch between the camera connectors for the Pi Zero and Model A&B series
  • Specs - 5MP 1080P OV5647, crisp photos, and sharp videos with a decent frame rate
  • Easy to use – Easy setup with paper instructions to help you activate the camera feature on Raspbian.
  • Application: Small form factor for a tiny home video security system, monitoring 3D printer or other camera projects. Feel free to contact Arducam if you need any help with the product

There is no universal maximum screenshot dimension established by the cited Puppeteer references. Do not plan around a fixed maximum without checking the specific browser version and runtime environment you deploy. For especially tall pages or large output files, validate the capture in that environment and account for the extra work of rendering and handling a larger image; avoid assuming that a successful local capture guarantees the same result under a different runtime configuration.

Troubleshoot unexpected screenshot dimensions

  • The image is only as tall as the viewport. A regular screenshot captures the viewport. Set fullPage: true if you intend to capture the full page.
  • The screenshot is a smaller region than expected. Check the clip’s x, y, width, and height. A clip defines the capture rectangle; it does not resize the page layout.
  • The page layout changed after setting dimensions. The viewport can affect responsive behavior. Set it before navigating when you want the page to load against that viewport, and check whether mobile or touch emulation is also enabled. Puppeteer notes that changing viewport settings can reload a page in certain cases, including toggling mobile or touch emulation; see the Screen configuration guide.
  • The file’s pixel dimensions do not match the CSS dimensions. Check deviceScaleFactor, capture options, and the actual generated file. A viewport is measured in CSS pixels; do not infer the output file size from viewport values alone.
  • A clipped area outside the viewport is missing. Review the clip coordinates and set captureBeyondViewport: true explicitly when the capture should extend beyond the viewport. Puppeteer documents that as the default when a clip is present, but explicit configuration helps identify the intended behavior.
  • The page changed or reloaded around a viewport update. Configure the viewport before navigation where practical, especially when changing mobile or touch emulation. If you resize later, wait for the page to settle before taking the screenshot.
  • The capture is unexpectedly large or slow. A full-page screenshot includes more content than a viewport capture. Use a clip if you only need a particular area, and validate unusually tall pages in the runtime you will use. The cited API documentation does not provide a universal dimension cap or performance benchmark.

Frequently asked question

Can I get screenshot bytes instead of writing directly to a file?

Yes. The Page.screenshot() API documents a Uint8Array result as well as a base64-string overload. For example, const bytes = await page.screenshot(); returns the image bytes, which your application can pass to its own storage or response code.

Frequently Asked Questions

Can I get screenshot bytes instead of writing directly to a file?

Yes. Puppeteer’s Page.screenshot() API documents a Uint8Array result as well as a base64-string overload. Use const bytes = await page.screenshot(); to get the image bytes for your own storage or response code.

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

Quick Recap

Bestseller No. 1
Arducam 5MP Camera for Raspberry Pi, 1080P HD OV5647 Camera Module V1 for Raspberry Pi5/4/3/3B+, and Other A/B Series
Arducam 5MP Camera for Raspberry Pi, 1080P HD OV5647 Camera Module V1 for Raspberry Pi5/4/3/3B+, and Other A/B Series
Integral IR filter; Still picture resolution: 2592 x 1944; Max video resolution: 1080p
$6.99
Bestseller No. 3
Arducam for Raspberry Pi Camera Module V2-8 Megapixel,1080p IMX219 Raspberry Pi 5 Camera
Arducam for Raspberry Pi Camera Module V2-8 Megapixel,1080p IMX219 Raspberry Pi 5 Camera
Sensor: 8 megapixel IMX219, Max. resolution: 3280 (H) x 2464 (V); Frame Rates: 1080p47, 1640 × 1232p41 and 640 × 480p206
$16.99
Bestseller No. 4
Arducam for Raspberry Pi Zero Camera Module, 5MP OV5647 1080P Webcam on Raspbian (Cables in 2 Kinds)
Arducam for Raspberry Pi Zero Camera Module, 5MP OV5647 1080P Webcam on Raspbian (Cables in 2 Kinds)
Specs - 5MP 1080P OV5647, crisp photos, and sharp videos with a decent frame rate
$9.49

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.