Playwright screenshot resolution has two controls: the viewport sets the page’s layout size in CSS pixels, while the screenshot’s scale sets how many image pixels represent each CSS pixel. Choose the viewport for the layout you want to capture, then choose scale: 'css' for a one-to-one CSS-pixel image or scale: 'device' for output at the emulated device-pixel ratio.
Viewport size and screenshot resolution are different
A viewport determines the browser’s emulated visible page area and responsive layout. For example, a viewport of 1440 by 900 means the page lays out at 1440 CSS pixels wide and 900 CSS pixels tall. It does not necessarily mean the saved screenshot will be 1440 by 900 image pixels: that also depends on the screenshot scale and device scale factor.
The device scale factor (DPR) describes the relationship between CSS pixels and device pixels. With a DPR of 2, a CSS-pixel layout can be represented by twice as many device pixels in each dimension. Playwright lets you set the DPR with deviceScaleFactor on a browser context or in Playwright Test configuration. The screenshot’s scale option determines whether the output follows CSS pixels or device pixels.
| What you want to control | Playwright setting | What it changes |
|---|---|---|
| Page layout width and height | viewport: { width, height } or page.setViewportSize() |
Emulated viewport dimensions in CSS pixels. |
| One output pixel per CSS pixel | page.screenshot({ scale: 'css' }) |
Image dimensions track the captured CSS-pixel dimensions. |
| Output at device-pixel density | page.screenshot({ scale: 'device' }) |
Image pixels correspond to device pixels, so higher DPR can increase output dimensions. |
| Emulated pixel density | deviceScaleFactor |
Sets the context’s DPR; it does not set viewport width or height. |
| Capture content below the visible area | fullPage: true |
Changes the captured extent to the full scrollable page, not the viewport or raster scale. |
Set screenshot resolution in Playwright with JavaScript
Set the viewport and device scale factor when creating the browser context. Then select screenshot scale explicitly so the output does not rely on a default. This complete Node.js example writes a PNG at device-pixel scale:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- 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 { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 2,
});
const page = await context.newPage();
try {
await page.goto('https://example.com', { waitUntil: 'load' });
await page.screenshot({ path: 'page.png', scale: 'device' });
} finally {
await context.close();
await browser.close();
}
})();
This requests a 1440×900 CSS-pixel viewport and emulates DPR 2. With scale: 'device', the screenshot uses device pixels; for a conventional 1:1 CSS-pixel output, change the screenshot option to scale: 'css'. The example uses the official API options; it is not a claim that the code was independently executed.
Use a different viewport for each capture
For an existing page, call page.setViewportSize() before navigation where possible:
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('https://example.com');
await page.screenshot({ path: 'mobile.png', scale: 'css' });
page.setViewportSize() resizes the page and resets its screen size. If you need coordinated control over viewport and screen behavior, configure the browser context before creating the page. Playwright documents this API in the Page API reference.
Rank #2
- 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 the right output scale
Use CSS scale for layout review and predictable dimensions
Choose scale: 'css' when you want one output image pixel per CSS pixel. It is usually the easiest choice for comparing page layouts, checking responsive breakpoints, or producing compact snapshots whose dimensions correspond directly to the page’s CSS-pixel size.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →await page.screenshot({ path: 'layout.png', scale: 'css' });
Use device scale for denser output
Choose scale: 'device' when the screenshot should use the emulated device’s pixel density. Pair it with an intentional deviceScaleFactor; otherwise the context’s DPR setting determines the density. A higher-density capture can preserve finer detail, but it also creates a larger image in each dimension and can increase file size and downstream processing work.
const context = await browser.newContext({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 2,
});
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'retina.png', scale: 'device' });
The Page API reference describes screenshot scale as defaulting to device, but defaults can be version-sensitive. Set the option explicitly when exact dimensions matter, and check the documentation matching your installed Playwright version. See Playwright’s Page API and its Screenshots documentation for the CSS-versus-device distinction.
Rank #3
- 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.
Set dimensions in Playwright Test
Playwright Test’s configuration can establish a consistent viewport and device scale factor for tests, rather than repeating them in each test. Put these values under use in playwright.config.js:
const { defineConfig } = require('@playwright/test');
module.exports = defineConfig({
use: {
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 2,
},
});
To make a test screenshot at CSS-pixel scale, specify the screenshot scale in the test:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
const { test } = require('@playwright/test');
test('capture at CSS-pixel scale', async ({ page }) => {
await page.goto('https://example.com');
await page.screenshot({ path: 'page.png', scale: 'css' });
});
Playwright Test documents a default viewport of 1280×720 and a default deviceScaleFactor of 1 in its options documentation reviewed in 2026. These are documented defaults, not measurements; explicit settings are better for repeatable captures. Setting viewport: null opts out of the consistent viewport and makes dimensions depend on the host window, which Playwright describes as non-deterministic. See Playwright Test options.
Rank #4
- 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
Capture a full-page screenshot without confusing it with resolution
fullPage: true captures the page’s full scrollable extent rather than only the visible viewport. It does not set a fixed image height, viewport size, or pixel density. The final height follows the page’s scrollable content, so pages with different content heights can produce different image dimensions even when the viewport and scale are identical.
await page.screenshot({
path: 'full-page.png',
fullPage: true,
scale: 'css',
});
Use viewport or setViewportSize() to control the layout width and visible viewport, scale and deviceScaleFactor for pixel density, and fullPage only when the desired capture should extend beyond the fold. The Page API documents screenshot and viewport options.
Common resolution problems and fixes
- The image is larger than the viewport dimensions. You may be capturing at
scale: 'device'with a DPR above 1. Setscale: 'css'for one image pixel per CSS pixel, or lowerdeviceScaleFactorif device-pixel output is not needed. - The page layout is not the intended desktop or mobile size. Set the viewport explicitly on the context or call
page.setViewportSize(). Changing output scale alone does not change responsive layout width. - The screenshot is taller than expected. Check whether
fullPage: trueis enabled. It captures the full scrollable page; remove it for a viewport-only image. - Screenshots differ across machines. Check for
viewport: null, which uses host-window dimensions. Specify a fixed viewport, DPR, and screenshot scale; keep browser and Playwright versions consistent when exact repeatability matters. - The reported screen dimensions seem unexpected after resizing.
page.setViewportSize()resets the page’sscreensize. Configure the context before creating pages when screen and viewport dimensions both need deliberate control. - The output looks insufficiently detailed. Confirm that the context has the intended
deviceScaleFactorand that the screenshot usesscale: 'device'. A larger viewport increases layout size; it is not the same as increasing pixel density.
Performance, repeatability, and file size
Viewport dimensions, page height, and output pixel density all affect the amount of image data captured. A tall full-page capture or a high-DPR image can therefore take more memory and produce a larger file than a viewport-only CSS-scale screenshot. For routine visual regression checks, use a fixed viewport and explicit scale: 'css' unless testing high-DPI rendering is the goal. Reserve higher DPR and full-page extent for cases that require them.
Best Value
- 【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 stable comparisons, record the viewport, DPR, scale, and whether full-page capture is enabled as part of the test setup. Also wait for the page state that matters to the test before capturing; resolution settings cannot compensate for a page that has not finished rendering. No single image dimension can be inferred from viewport alone when device-scale output or full-page capture is involved.
Or skip the browser setup
For a one-request screenshot from an application or script, ScreenshotNeo accepts a URL and returns an image or PDF. Its screenshot endpoint is documented at ScreenshotNeo’s API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo’s clean-shot process accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can 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 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 with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Frequently Asked Questions
Does changing Playwright’s screenshot scale change the page layout?
No. The viewport controls layout dimensions; screenshot scale controls whether output pixels represent CSS pixels or device pixels.
Does a 1440 × 900 viewport guarantee a 1440 × 900 screenshot?
Only when the capture is viewport-only and uses CSS-pixel scale. Device-pixel scale and full-page capture can change the output dimensions.
Quick Recap
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.

