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

Set quality in page.screenshot() or locator.screenshot() when saving a JPEG or WebP: the accepted range is 0–100. It does not affect PNG. JPEG defaults to quality 80; WebP defaults to 100, which Playwright documents as lossless. Lower WebP values use lossy compression. Choose the format and setting for your needs, then compare representative captures—there is no universally optimal quality value.

Set quality for a Playwright screenshot

Use the type option to choose JPEG or WebP, and pass quality as a number from 0 through 100. For example:

await page.screenshot({
  path: 'screenshot.jpg',
  type: 'jpeg',
  quality: 60,
});

This saves a JPEG using the requested quality value. The number 60 is an example, not a recommendation or guarantee about file size or visual fidelity. Playwright’s API reference does not prescribe an ideal value or quantify how much a particular setting will shrink a particular page. Test with the kind of pages and content you actually capture if the trade-off matters.

The same documented quality and format options are available on the Locator screenshot method. That method captures a matched element rather than the page as a whole.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Complete JavaScript example

With Playwright installed in a Node.js project, this example opens a page and writes a JPEG screenshot. Replace the URL with the page you need to capture.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await page.screenshot({
      path: 'screenshot.jpg',
      type: 'jpeg',
      quality: 60,
    });
  } finally {
    await browser.close();
  }
})();

Use a .jpg or .jpeg filename for JPEG. The explicit type makes the intended encoding clear; if you omit it while providing a path, Playwright infers the type from the file extension. Without a path extension to infer from, the Page API defaults to PNG.

Choose JPEG, WebP, or PNG

Format choice determines whether the quality option applies and what its default means. These behaviors are documented for the Playwright Page screenshot API; Locator screenshots expose the same quality and format options.

Output Setting Documented behavior
JPEG type: 'jpeg' and quality: 0..100 Quality is applicable; the default is 80.
WebP type: 'webp' and quality: 0..100 Default quality 100 is lossless. Lower values use lossy compression.
PNG type: 'png' or a .png path quality does not apply. The Page API default type is PNG.

For example, WebP at its documented default can be requested explicitly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({
  path: 'screenshot.webp',
  type: 'webp',
  quality: 100,
});

If you need lossy WebP compression, choose a value below 100. If you want PNG, remove the quality option rather than expecting it to change the output. A PNG capture will not become smaller or visually different because you set quality.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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

Keep quality separate from image dimensions

quality controls encoding for JPEG and WebP; it is not the setting for pixel dimensions. The Page API’s scale option controls how CSS pixels map to output pixels:

  • scale: 'css' creates one image pixel per CSS pixel. Playwright describes this as keeping high-DPI screenshots small.
  • scale: 'device' creates one image pixel per device pixel. On high-DPI displays, this can make captures twice as large or more.

For example, use CSS scale when the capture should remain at CSS-pixel dimensions:

await page.screenshot({
  path: 'screenshot.jpg',
  type: 'jpeg',
  quality: 70,
  scale: 'css',
});

Changing quality cannot compensate for a larger pixel canvas in a predictable way across all pages. If a high-DPI capture is too large, decide whether device-pixel detail is actually needed; if not, CSS scale addresses dimensions directly. When both file weight and fidelity matter, compare combinations of format, quality, and scale using representative output.

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

Capture a particular element instead of the page

Use a Locator screenshot when the intended output is one matched element, such as a card or chart, rather than the full page viewport. The method scrolls the element into view and performs actionability checks. A locator that becomes detached causes an error.

const card = page.locator('.product-card');
await card.screenshot({
  path: 'product-card.webp',
  type: 'webp',
  quality: 85,
});

Replace .product-card with a selector that identifies the element on the page. The quality choice still affects only JPEG and WebP encoding; it does not alter the element’s CSS dimensions.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Control the capture when consistency matters

Output format and quality are only part of screenshot consistency. Page state, animation, capture area, and styling can also change what appears in an image. The Page screenshot API documents options for controlling these cases:

  • fullPage captures the scrollable page rather than only the viewport.
  • clip limits capture to a specified area.
  • animations: 'disabled' fast-forwards finite animations and cancels infinite animations for the capture; infinite animations are restored afterward.
  • mask and maskColor let you cover selected page elements.
  • style applies a stylesheet for the screenshot.
  • omitBackground omits the background where applicable; it is not applicable to JPEG.
  • caret controls the caret behavior in the capture.

For instance, a full-page JPEG with animations disabled could use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({
  path: 'full-page.jpg',
  type: 'jpeg',
  quality: 75,
  fullPage: true,
  animations: 'disabled',
});

These options solve different problems. Use encoding quality to choose JPEG or lossy WebP compression, scale to control pixel dimensions, and capture controls to make the content or area more consistent.

Do not confuse capture quality with screenshot assertions

Playwright’s screenshot assertions are a separate feature from saving an image with page.screenshot(). The PageAssertions reference says screenshot snapshots must use .png or .webp extensions, and describes both as lossless. Assertion options include pixel-difference tolerances and default to disabling animations. Those defaults should not be assumed to match a direct Page screenshot call.

Likewise, Playwright Test’s screenshot configuration controls when test-runner screenshots are taken, with modes including off, on, only-on-failure, and on-first-failure. Options such as fullPage and omitBackground can configure those captures. To set image encoding quality for a particular capture, use the screenshot API method and its options rather than treating the runner’s capture mode as an encoding-quality setting.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

Or skip the browser setup

If you need a screenshot from a URL without managing Playwright or a browser locally, ScreenshotNeo offers a website screenshot API and MCP server. Its API can return PNG, JPEG, WebP, or PDF; its docs list screenshot controls including full-page capture, viewport and device presets, and image format options. For its API details, see the ScreenshotNeo documentation.

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

Example one-call request using cURL:

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

Equivalent Python request:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Equivalent Node.js request:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response includes X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf 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. Every feature is available on every plan. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot unexpected output

The quality setting seems to do nothing

Check the actual output format. If the path ends in .png, or you set type: 'png', the quality option does not apply. Set type: 'jpeg' or type: 'webp' and use a matching filename extension.

The file is larger than expected

Check whether you captured at device scale on a high-DPI viewport, or used fullPage: true and therefore captured more content than the viewport. CSS scale produces one output pixel per CSS pixel. For JPEG or lossy WebP, test lower quality values on your own pages; the official documentation does not promise a particular reduction.

The output type is not the one you intended

When providing a path, Playwright infers screenshot type from the extension unless you set type explicitly. Use a matching extension such as .jpg, .webp, or .png, and set type when you want to make the choice unambiguous.

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

A Locator screenshot fails

Confirm the selector matches an attached element at capture time. Locator screenshots scroll the match into view and perform actionability checks; if the element has been detached, Playwright reports an error. Re-resolve the locator after page changes and capture once the intended element is present.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.

A test screenshot differs from a direct screenshot

Check whether the image comes from a screenshot assertion, Playwright Test’s automatic screenshot configuration, or a direct call to page.screenshot(). Their purposes and documented defaults differ. Assertion defaults include disabling animations, while the test-runner setting governs when automatic screenshots are taken.

Version and reference notes

Playwright’s API references are rolling documentation, so confirm option availability against the version installed in your project when maintaining version-specific code. The Page screenshot reference identifies maskColor as introduced in v1.35, style in v1.41, and signal in v1.62. The examples above use the core format and quality options. This article concerns the Playwright Page and Locator screenshot APIs, not a guarantee that every option is available in every historical release.

Frequently Asked Questions

Can I set a different default quality for every Playwright screenshot?

Pass the desired value to the individual screenshot call where you need it. The documented JPEG and WebP defaults are format behaviors; the cited API material does not establish a separate global quality default.

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

Does lowering JPEG quality change the dimensions of the screenshot?

No. Quality is an encoding option, while the screenshot’s output pixel mapping is controlled separately by options such as scale.

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.