What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Set the screenshot pixel grid explicitly: use scale: 'css' for one output pixel per CSS pixel, or scale: 'device' for one output pixel per device pixel. Page and Locator screenshots default to 'device', while screenshot assertions default to 'css'. Making the choice explicit prevents unexpectedly large images and mismatched visual tests.
Set the scale on a page or element screenshot
Pass scale in the options object for page.screenshot() or locator.screenshot():
await page.screenshot({ path: 'page-css.png', scale: 'css' });
await page.screenshot({ path: 'page-device.png', scale: 'device' });
await page.locator('.card').screenshot({
path: 'card-css.png',
scale: 'css'
});
The setting changes the image’s pixel grid; it does not change the browser viewport, CSS layout, or emulated device pixel ratio. Use 'css' when the file should track the dimensions your layout reports in CSS pixels. Use 'device' when you need device-pixel detail, such as a high-DPI visual asset.
What css and device mean
scale: 'css'
Playwright writes one image pixel for each CSS pixel. A 900-CSS-pixel-wide viewport therefore produces an image that is 900 pixels wide, regardless of whether the emulated device has a higher device pixel ratio. This is usually the most convenient choice for documentation, predictable artifact sizes, and visual comparisons that are defined in layout pixels.
#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
scale: 'device'
Playwright writes one image pixel for each device pixel. On a high-DPI emulation, the same CSS viewport can produce an image that is twice as wide or larger than the CSS-pixel version. The result preserves more physical-pixel detail but consumes more memory and storage.
The Page API documents these definitions and the default on its screenshot method. The Locator API documents the same choice for element screenshots at playwright.dev/docs/api/class-locator.
Know the different defaults
Do not assume every Playwright screenshot-related API uses the same default. Captures and assertions are intentionally different:
| Operation | How to set the scale | Documented default | Practical consequence |
|---|---|---|---|
page.screenshot() |
scale: 'css' or 'device' |
'device' |
A high-DPI context can make an otherwise ordinary capture unexpectedly large. |
locator.screenshot() |
scale: 'css' or 'device' |
'device' |
Element images can also be larger than their CSS bounding-box dimensions. |
| Screenshot assertions | Set scale in the assertion options |
'css' |
A baseline made by an assertion may not match a manually captured image that used the capture default. |
| Playwright test screenshot configuration | Set the screenshot scale in test configuration | 'css' |
Test artifacts and expected snapshots follow the assertion/test default unless overridden. |
The assertion and test-configuration behavior is described in the PageAssertions API and TestConfig API. If dimensions matter, specify the option rather than relying on a default that differs between APIs.
Complete Node.js example
Install Playwright
- Create a project and install the package:
npm init -y && npm install -D playwright. - Install the browser binaries:
npx playwright install chromium. - Save the following as
scale-screenshots.js.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: 1280, height: 800 },
deviceScaleFactor: 1
});
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
// One output pixel per CSS pixel.
await page.screenshot({
path: 'example-css.png',
fullPage: true,
scale: 'css'
});
// One output pixel per device pixel.
await page.screenshot({
path: 'example-device.png',
fullPage: true,
scale: 'device'
});
const heading = page.getByRole('heading', { name: 'Example Domain' });
await heading.screenshot({
path: 'heading-css.png',
scale: 'css'
});
await browser.close();
})();
The viewport controls the page’s CSS layout. The scale option controls how that layout is rasterized into the file. Setting deviceScaleFactor: 1 in this example makes the two modes easier to compare, but it is not a replacement for scale.
Use the right scale for screenshot assertions
Visual assertions use their own option. Set it on the assertion when you want the expectation to be unambiguous:
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
import { test, expect } from '@playwright/test';
test('checkout card has the expected appearance', async ({ page }) => {
await page.goto('https://example.com/checkout');
await expect(page.locator('.checkout-card')).toHaveScreenshot(
'checkout-card.png',
{ scale: 'css' }
);
});
Keeping scale: 'css' on both the assertion and any manually generated reference image prevents a baseline from being compared with a device-pixel capture. If your project intentionally tests high-DPI rendering, use 'device' consistently instead.
You can also establish the scale through Playwright Test configuration rather than repeating it. Use the screenshot option supported by your installed Playwright version and keep the configuration, assertion, and baseline generation on the same setting. The documented test configuration default is 'css'; see the TestConfig API for the current configuration shape.
Do not confuse screenshot scale with deviceScaleFactor
deviceScaleFactor emulates the device scale factor, commonly called DPR. Playwright documents its default as 1 in the Browser API and TestOptions API. It can affect media queries, canvas rendering, and the browser’s notion of device pixels.
scale is a separate output choice. It selects whether Playwright encodes one CSS pixel or one device pixel as one image pixel. Changing the screenshot scale does not alter window.devicePixelRatio, responsive breakpoints, or the viewport. When an image is not the expected size, inspect all three inputs:
- Viewport width and height, which determine the CSS layout.
deviceScaleFactor, which determines the emulated device pixel ratio.- Screenshot
scale, which determines the output pixel grid.
Choose a scale deliberately
| Requirement | Recommended setting | Why |
|---|---|---|
| Stable dimensions tied to responsive CSS | scale: 'css' |
Image dimensions follow CSS pixels and remain smaller on high-DPI contexts. |
| Retina or print-quality raster detail | scale: 'device' |
Every device pixel is retained, producing a denser image when DPR is above one. |
| Cross-platform visual regression tests | Explicitly choose one value, commonly 'css' |
It avoids silently changing artifact dimensions when the emulated device or runner changes. |
| Matching an existing device-pixel baseline | scale: 'device' |
The new capture uses the same physical-pixel grid as that baseline. |
There is no universally “best” value. The important practice is to select one for each workflow and use it everywhere that workflow creates, compares, or publishes images.
Capture pages and elements without accidental mismatches
Full-page captures
Combine fullPage: true with the scale you selected. Full-page mode extends the capture beyond the viewport, so the resulting height can be large even with CSS scale. If the page has animations, rotating content, or late-loading fonts, wait for a stable state before capturing.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRank #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.
await page.goto('https://example.com/catalog', { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({
path: 'catalog.png',
fullPage: true,
scale: 'css'
});
Element captures
A Locator screenshot uses the element’s rendered bounds. The same scale rule applies, so a high-DPI context can make a small CSS card produce a substantially larger file:
const card = page.locator('[data-testid="product-card"]').first();
await card.waitFor();
await card.screenshot({ path: 'product-card.png', scale: 'css' });
Make sure the locator identifies the intended element and that its state is stable. A changing hover state, expanded menu, or web font can create a visual difference that has nothing to do with the selected scale.
Troubleshoot unexpected screenshot dimensions
The image is roughly twice as wide or tall as expected
Check whether the capture used the default 'device' scale in a high-DPI context. Add scale: 'css' explicitly, or calculate your expected dimensions using the context’s device scale factor.
The assertion does not match a manually saved screenshot
Compare the options on both operations. Page and Locator captures default to 'device', whereas screenshot assertions default to 'css'. Set the same value on the assertion and the capture that produced the baseline.
Changing scale did not change responsive behavior
That is expected. Scale only selects the output pixel grid. To test a different responsive layout, change the viewport; to emulate a different DPR, change deviceScaleFactor.
TypeScript reports an invalid scale value
Use the literal values 'css' or 'device', not an arbitrary string. If the value comes from a variable, type it as the Playwright screenshot scale union or narrow it to those two literals before passing it to the API.
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
Images differ even though the dimensions are correct
Scale does not make a page deterministic. Freeze animations, wait for fonts and relevant data, use a fixed viewport and browser version, and ensure the same device emulation settings are used when generating and comparing baselines.
The file is too large for storage or review
Use CSS scale when device-pixel detail is not required. It produces fewer pixels on high-DPI contexts. For very tall pages, consider whether a full-page image is necessary or whether element-level captures answer the test or documentation need.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Performance, storage, and reproducibility
Device-scale captures can contain substantially more pixels, increasing encoding time, memory use, upload size, and visual-diff work. CSS-scale captures generally reduce those costs and make dimensions easier to reason about. The trade-off is loss of extra device-pixel detail.
For reliable pipelines, record the browser, viewport, device scale factor, screenshot scale, color scheme, and any device preset alongside the artifact. Keep the same values for baseline generation and comparison. If a project changes from the capture default to an explicit scale, regenerate its baselines as a deliberate migration; old and new files may have different dimensions even when the page did not change.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If you need a hosted URL-to-image service rather than maintaining Playwright browsers, ScreenshotNeo returns PNG, JPEG, WebP, or PDF from one request. It is not a drop-in replacement for Playwright’s scale option, so use Playwright when you need direct control of CSS-versus-device-pixel output. ScreenshotNeo is useful when the main task is obtaining a clean page image without running a browser yourself.
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers. It also offers image resizing, full-page capture, element selection, custom CSS and JavaScript, waits, blocking controls, device presets, retina scale, caching, signed links, asynchronous jobs, bulk capture, and an MCP server with take_screenshot, get_page_info, and capture_pdf for AI clients.
Recommended Free Tools
See the ScreenshotNeo API documentation for request options. A direct cURL request looks like this:
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Python request is:
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()
open("shot.webp", "wb").write(r.content)
And in 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}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', buffer);
The free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without adding a card.
FAQ
Can I pass a numeric value such as 2 to scale?
No. Playwright’s screenshot scale choice is the string 'css' or 'device'. Use deviceScaleFactor for emulated DPR and an image-processing step if you need a custom post-capture size.
Does scale: 'css' reduce the browser’s device pixel ratio?
No. The page still renders with the configured emulation. Only the mapping from rendered pixels to the saved screenshot changes.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteShould a team standardize on CSS or device scale?
Standardize on the grid that matches the deliverable: CSS scale for layout-oriented artifacts and most visual tests, device scale for high-DPI assets. Whichever you choose, set it explicitly in capture and assertion code.
Frequently Asked Questions
Can I pass a numeric value such as 2 to scale?
No. Playwright accepts the string values ‘css’ and ‘device’. Use deviceScaleFactor for emulated DPR and resize the resulting image separately if you need a custom output size.
Does scale: ‘css’ reduce the browser’s device pixel ratio?
No. It changes only how rendered pixels are encoded in the saved image; the page still uses the configured emulation.
Should a team standardize on CSS or device scale?
Use CSS scale for layout-oriented artifacts and most visual tests, or device scale for high-DPI assets. Set the choice explicitly in both capture and assertion code.
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 →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.

