Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesSet a Playwright screenshot’s aspect ratio by controlling the rectangle being captured. For a normal viewport screenshot, choose a viewport width and height whose ratio matches your target (for example, 1600×900 for 16:9). For an exact crop, leave the page viewport as it is and pass a clip rectangle with the required width and height to page.screenshot(). The ratio is always width ÷ height; scale and deviceScaleFactor change pixel density, not that CSS-space ratio.
Choose the rectangle that should have the ratio
There are two reliable approaches:
- Viewport control: set the browser’s CSS viewport dimensions before navigation. This changes responsive layout as well as the screenshot shape.
- Clip control: capture a specific rectangle from the current page. This preserves the existing layout but crops the saved image to the requested dimensions.
Calculate the target as width / height. A 16:9 image can be 1280×720, 1600×900, or any other pair with the same proportion. A 3:2 image can be 1200×800. Use explicit dimensions rather than relying on defaults when reproducible geometry matters.
Set a viewport aspect ratio in a Playwright script
Call page.setViewportSize() before page.goto() whenever possible. Sites can alter their layout when the viewport is resized, so setting it first avoids an initial layout at the wrong size.
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
// 3:2 CSS-pixel viewport
await page.setViewportSize({ width: 1200, height: 800 });
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({
path: 'viewport-3-2.png',
scale: 'css'
});
await browser.close();
The visible screenshot rectangle is 1200×800 CSS pixels, so its intended shape is 3:2. Replace those numbers with the dimensions required by your design, test fixture, or social-media format. The page may still contain content below the fold; that content is not included unless you request a full-page capture.
Free tools Windows power users keep installed
One-click scans. No signup required.
#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
Configure the ratio in Playwright Test
Playwright Test’s use.viewport option sets the viewport for tests. The documented default is 1280×720 (16:9), but an explicit value makes the test independent of that default and of future configuration changes.
import { test } from '@playwright/test';
test.use({
viewport: { width: 1200, height: 800 }, // 3:2
});
test('capture a deterministic viewport', async ({ page }) => {
await page.goto('https://example.com');
await page.screenshot({
path: 'test-viewport.png',
scale: 'css',
});
});
Put the setting in a project or configuration file when every test in that project needs the same geometry; use test.use() for a single test or group. Keep the dimensions in CSS pixels and document the intended ratio next to them.
Capture an exact ratio with clip
Use clip when the page should keep its current responsive viewport but the output must be a fixed rectangle. The object accepts x, y, width, and height.
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({
path: 'crop-16-9.png',
clip: { x: 0, y: 0, width: 1600, height: 900 },
scale: 'css',
});
await browser.close();
The clip coordinates are measured from the page’s screenshot surface. Make sure the rectangle is within the available page area and that the page has loaded the content you expect. Change x and y to frame a different region without changing the ratio.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Viewport versus clip
| Method | Controls | What is included | Best use |
|---|---|---|---|
| Viewport | Browser CSS width and height | Visible viewport | Testing responsive breakpoints or producing a complete above-the-fold frame |
| Clip | Screenshot rectangle and position | Only the selected rectangle | Exact framing while retaining the page’s normal layout |
fullPage: true |
Scrollable page extent | Entire scrollable page | Documentation or archival captures where variable height is acceptable |
Why fullPage does not guarantee an aspect ratio
fullPage: true captures the complete scrollable page. Its height depends on the document’s content, expanded sections, lazy-loaded elements, and layout, so the resulting ratio is content-dependent. Do not use it when a fixed 16:9, 4:3, or other output rectangle is a requirement. Use a viewport or an explicit clip instead.
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
await page.screenshot({
path: 'entire-page.png',
fullPage: true,
scale: 'css',
});
If you need both full content and a fixed shape, capture the full page first and perform a separate, deliberate crop in an image-processing step. A Playwright clip itself is the simpler choice when only one fixed rectangle is needed.
Understand scale and deviceScaleFactor
scale determines how CSS pixels map to output pixels:
scale: 'css'produces one screenshot pixel per CSS pixel.scale: 'device'produces one screenshot pixel per device pixel.
Both preserve the same underlying rectangle. The second setting can create a larger pixel file without changing the intended shape. Browser contexts also have a deviceScaleFactor; the documented default is 1. Set it when you need a controlled emulated device pixel ratio, but do not use it as an aspect-ratio setting.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →const context = await browser.newContext({
viewport: { width: 1200, height: 800 },
deviceScaleFactor: 2,
});
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({
path: 'retina-3-2.png',
scale: 'device',
});
If your downstream system requires exact file dimensions, verify whether it expects CSS-pixel dimensions or device-pixel dimensions and choose scale accordingly.
Make captures stable before measuring the ratio
Aspect-ratio math cannot correct a moving page. Before the screenshot:
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 viewport dimensions before navigation.
- Wait for the relevant page state, such as a selector or network idle, rather than relying on an arbitrary short delay.
- Dismiss dialogs and disable animations if they change the captured frame.
- For lazy content, scroll or wait until the content is present before using a clip.
- Use the same browser, viewport, device scale, and screenshot scale in visual tests.
These controls affect what appears inside the rectangle, while only the rectangle’s width and height determine its aspect ratio.
Reusable helpers for common ratios
A small helper can derive a height from a width and ratio while keeping integer CSS pixels.
function dimensionsFor(width, ratioWidth, ratioHeight) {
const height = Math.round(width * ratioHeight / ratioWidth);
return { width, height };
}
const { width, height } = dimensionsFor(1600, 16, 9);
await page.setViewportSize({ width, height });
await page.goto('https://example.com');
await page.screenshot({ path: '16-9.png', scale: 'css' });
Rounding can create a one-pixel difference from the mathematical ratio. If an external service validates dimensions exactly, choose integer dimensions that divide cleanly or let that service perform the final resize.
Troubleshooting aspect-ratio problems
The image is the wrong shape
Check whether another screenshot call uses fullPage: true, whether a clip overrides the viewport, and whether your image pipeline resizes the file afterward. Log the width and height passed to the relevant API and inspect the final file’s pixel dimensions.
The layout changes unexpectedly
You likely resized after navigation or changed the viewport between captures. Create the page with the final viewport and set it before goto(). Remember that viewport control intentionally triggers responsive breakpoints; use clip if you need the original layout.
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
The clip is empty or cuts off content
Verify x, y, width, and height are in the page’s coordinate space and that the target content has loaded. Wait for a selector, scroll lazy content into view, and capture a rectangle that exists on the page.
The file has more pixels than expected
scale: 'device' or a deviceScaleFactor above 1 increases pixel density. Use scale: 'css' for one output pixel per CSS pixel, or keep device scaling and treat the larger file as a density choice rather than a ratio error.
Visual tests differ between machines
Set an explicit viewport, browser context options, screenshot scale, and installed Playwright version. Do not depend on a machine’s default window size or device pixel ratio.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance, reliability, and cost considerations
Viewport screenshots generally involve less work than full-page captures because Playwright does not need to assemble the entire scrollable document. Clips can also limit the captured area, but the browser still has to render the page state underneath it. Waiting for network idle improves completeness but can delay pages that keep long-lived connections open; a specific ready selector is often more deterministic.
For visual regression, keep dimensions, browser version, fonts, animations, and device scale consistent. Store the ratio as part of the test’s contract so a change from 16:9 to another shape is reviewed as an intentional test change rather than a pixel-diff surprise.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchBest 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.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API when you do not want to maintain Playwright launch, viewport, waiting, and cleanup code. Its request parameters include viewport and capture options, and it can return PNG, JPEG, WebP, or PDF. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. An 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 shots.
Example cURL request (replace the URL and key):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
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)
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 failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
See the ScreenshotNeo documentation for the viewport, clipping, format, and other request parameters. Sign up free to get 1,000 screenshots each month without a card.
Frequently Asked Questions
Can I set an aspect ratio with only Playwright’s scale option?
No. Set the viewport or clip width and height; scale changes pixel density.
What ratio does the default Playwright Test viewport use?
The documented default is 1280×720, which is 16:9. Set it explicitly when geometry must remain stable.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Does a full-page screenshot have a fixed height?
No. Its height follows the scrollable document, so its aspect ratio varies with page content.
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.

