DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Capture a Web Page Screenshot at 2× Resolution in Playwright

Set Playwright's browser context to deviceScaleFactor: 2 and use scale: 'device' to capture screenshots at twice the CSS-pixel dimensions.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set deviceScaleFactor: 2 on the browser context and use scale: 'device' in page.screenshot(). Together, these settings make each CSS pixel map to two output pixels in each dimension. For example, a 1280 × 800 CSS-pixel viewport yields a 2560 × 1600 image.

Capture a viewport screenshot at 2×

Configure the device scale factor when you create the browser context, then explicitly choose device-pixel output in the screenshot call:

As an Amazon Associate I earn from qualifying purchases.

const context = await browser.newContext({
  viewport: { width: 1280, height: 800 },
  deviceScaleFactor: 2,
});
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'page-2x.png', scale: 'device' });

This example assumes browser is an already launched Playwright browser. The 2560 × 1600 dimensions follow arithmetically from the configured viewport and device-pixel ratio; they are not a separate benchmark.

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

Why both settings matter

deviceScaleFactor belongs to the browser context and defaults to 1. Setting it to 2 requests a 2:1 device-pixel ratio. The screenshot option scale controls how CSS pixels become output pixels: 'css' produces one output pixel per CSS pixel, while 'device' produces one output pixel per device pixel. Playwright documents 'device' as the screenshot scale default.

#1 Best Overall
Sale
Dell 27 Monitor S2725QS, 4K UHD IPS, 120Hz, 5ms, FreeSync Premium | 350 cd/m2 Brightness, 1,500:1 Contrast, 99% sRGB, Anti-Glare, HDMI, DisplayPort, USB‑C, Height Adjustable, Swivel, Pivot
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.

For a deliberate 2× result, specify both. If you set only scale: 'device' while the context DPR remains 1, the output can still be 1×. Setting only deviceScaleFactor: 2 does not explicitly select the screenshot output scale.

Capture the full scrollable page at 2×

Add fullPage: true to capture content beyond the current viewport:

Rank #2
Sale
LG 27US500-W Ultrafine Monitor 27-Inch 4K UHD (3840x2160) HDR10 IPS Borderless Design Reader Mode Flicker Safe Switch App HDMI DisplayPort - White
  • 4K UHD with 1000:1 Contrast Ratio - This UltraFine display with a 1000:1 contrast ratio displays deeper blacks and vivid colors in UHD clarity. With wide viewing angles, it gives creative professionals the ability to view and work with highly-detailed, digital imagery.
  • 4K HDR10 DCI-P3 - Explore HDR10 content the way it was meant to be seen with up to 90% DCI-P3 color gamut expression—an elevated color spectrum that brings brilliant color to life.
  • Onscreen Control - You can customize the workspace by splitting the display or adjusting basic monitor options with just a few mouse clicks.
  • Ergonomic Stand - The ergonomic stand makes it easy to flexibly adjust the tilt of the screen in the optimal position for you.
  • What's In The Box - Stand Body, Stand Base, Screws, Power Adapter, HDMI Cable, Quick Start Guide, Registration Card, Warranty.
await page.screenshot({
  path: 'full-page-2x.png',
  fullPage: true,
  scale: 'device',
});

The full-page option expands the captured page height; it does not change pixel density. With the context still configured with deviceScaleFactor: 2, the full-page image uses 2× output pixels in both dimensions. Its height depends on the page’s scrollable content.

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.

Capture just one element

When you need a component rather than the viewport or whole page, take a locator screenshot. The same context scale setting applies:

Rank #3
Sale
Dell 32 Monitor S3225QS, 4K UHD VA, 120Hz, FreeSync Premium, Eye Comfort | 3840x2160, 31.5in, 3000:1 Contrast, 300 cd/m2 Brightness, 4ms, 99% sRGB, Anti-Glare, HDMI, DisplayPort
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in 4K visuals with a VA panel. Enjoy true-to-life colors with 99% sRGB and 95% DCI-P3 coverage. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.
await page.locator('.report-card').screenshot({
  path: 'report-card-2x.png',
  scale: 'device',
});

Replace .report-card with a selector for the element you want. Locator screenshots are documented in Playwright’s screenshot guide.

Check the output and keep visual comparisons consistent

  • For a viewport capture, multiply each CSS viewport dimension by two to estimate the output dimensions. For a full-page image, the width follows the viewport while the height depends on the scrollable page.
  • If the image is smaller than expected, check that the context uses deviceScaleFactor: 2 and that the capture uses scale: 'device', not 'css'.
  • A 2× image has more output pixels than a 1× image, but the documentation does not establish a fixed file-size multiplier. File size also depends on image content and format.
  • Higher resolution does not make visual regression tests deterministic. Playwright notes that rendering can vary with the operating system, browser version, settings, hardware, power source and headless mode. Keep the runtime environment consistent with the baseline when comparing screenshots.

Troubleshooting

The screenshot is still 1×

Confirm that deviceScaleFactor: 2 is set on the same browser context that created the page. Also specify scale: 'device' in the screenshot options. A context left at its default DPR of 1 will not produce 2× output merely because device scaling is selected.

Rank #4
Samsung 27" Odyssey G5 (G51F) Series QHD (1440P) Gaming Monitor | 180Hz, 1ms, AMD FreeSync, HDR10, Height Adj Stand, Black Equalizer, Virtual Aim Point, Auto Source Switch+ (LS27FG512ENXZA)
  • QHD Resolution (2560 x 1440) has 1.7 times the pixel density of Full HD for incredibly detailed pinsharp images
  • HDR10 provides brighter highlights and nuanced shadow for added depth - making every scene feel more vivid and realistic
  • The 180Hz refresh rate minimizes lag for gameplay with ultra-smooth action. Plus, the 1ms response time helps capture your moves in real-time, allowing you to react fast for gaming precision
  • AMD FreeSync reduces choppiness, screen lag and image tearing, ensuring that your fast-paced, complex in-game action is stable with minimal stutter
  • Ergonomic stand allows for tilt, pivot and height adjustments to maximize gaming comfort

The screenshot has the right width but misses lower-page content

A normal page screenshot captures the current viewport. Add fullPage: true when you need the full scrollable page; this changes the captured extent, not the pixel ratio.

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

Visual regression output changes between runs

Check whether the operating system, browser version, headless mode, settings or hardware differ from the baseline environment. A high-DPI capture controls output resolution, not all sources of rendering variation.

Best Value
Dell 27 Monitor S2725QC, 4K UHD IPS, 120Hz, 99% sRGB, 4ms, FreeSync Premium
  • Low blue light: The improved ComfortView Plus reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Easy connectivity: Keep your desk organized and clutter-free with a single USB-C cable (up to 65W power delivery).
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can return a screenshot or PDF from one GET request. Its clean-shot steps accept cookie and consent banners and remove 60+ known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers identify the page verdict and billing status. ScreenshotNeo also offers an MCP server for AI agents, with tools including take_screenshot, get_page_info and capture_pdf.

Its API supports viewport and device options, but the example below requests a screenshot of a URL; it does not specify a 2× scale. See the ScreenshotNeo documentation for API parameters.

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

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.

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

Sources

Playwright documentation can change over time; check the references for the version you use when version-specific behavior matters.

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.