October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Take a Website Screenshot as a JPEG in Node.js with Playwright

Use Playwright’s page.screenshot() in Node.js to save a website as JPEG, with a runnable example and guidance on quality, full-page capture, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s page.screenshot() method after navigating to the page. Set a .jpeg output path and, for an explicit format choice, type: 'jpeg'. The example below saves the visible browser viewport as screenshot.jpeg.

Install Playwright and its browser

In a Node.js project, install Playwright and download Chromium. Run these commands from the project directory:

As an Amazon Associate I earn from qualifying purchases.

npm install playwright
npx playwright install chromium

The installation command downloads the browser binary Playwright needs. If you prefer another supported browser, install it with the corresponding Playwright browser name and use that browser’s launcher instead.

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

Capture a website as a JPEG

This CommonJS script opens the URL, waits for navigation to complete, and writes a JPEG to the current working directory:

#1 Best Overall
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
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.jpeg',
      type: 'jpeg',
      quality: 80,
    });
  } finally {
    await browser.close();
  }
})();

Save it as, for example, screenshot.js, then run node screenshot.js. The screenshot is saved as screenshot.jpeg relative to the process’s current working directory, which is the directory from which you run the command.

What the code does

  • chromium.launch() starts a browser; browser.newPage() creates a page.
  • page.goto() navigates to the target URL before capture.
  • page.screenshot() saves the image. The path option writes to disk; without it, the method returns an image buffer instead.
  • The finally block closes the browser even if navigation or capture throws an error.

Choose the screenshot format, quality, and page area

JPEG format

Playwright infers the image format from the file extension when you provide path. A filename ending in .jpeg therefore produces a JPEG. Setting type: 'jpeg' as well makes the intended format explicit. The documented screenshot types are png, jpeg, and webp.

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

JPEG quality

The quality option accepts values from 0 to 100; Playwright documents 80 as the default. Lower values generally trade image detail for a smaller file, while higher values preserve more detail. This option applies to JPEG, not PNG.

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

Viewport or full page

By default, the screenshot captures the current viewport. To capture the full scrollable page, add fullPage: true to the screenshot options:

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.
await page.screenshot({
  path: 'full-page.jpeg',
  type: 'jpeg',
  quality: 80,
  fullPage: true,
});

A full-page capture can be substantially taller than a viewport screenshot, so use it when the entire document is needed rather than just the visible area.

Background and transparency

omitBackground is not applicable to JPEG. JPEG does not support transparency, so this option will not make a JPEG screenshot transparent.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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

Wait for the page state you need

A successful navigation does not necessarily mean a page’s asynchronously loaded content is ready to photograph. For a known page element, wait for it before calling screenshot():

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.goto('https://example.com');
await page.locator('main').waitFor({ state: 'visible' });
await page.screenshot({ path: 'screenshot.jpeg', type: 'jpeg' });

Replace main with a selector that identifies the content you need. If the site renders content after an interaction or a client-side request, wait for the relevant element or state instead of relying on an arbitrary delay.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

  • Playwright cannot find Chromium: Run npx playwright install chromium in the project environment. The package and browser binaries must be available where the script runs.
  • The file is not where expected: A relative screenshot path resolves from the process’s current working directory, not necessarily the folder containing the script. Run the command from the intended directory or provide an absolute path.
  • The page is missing content: Wait for a selector that appears when the needed content is ready before taking the screenshot. Navigation completion alone may precede later page updates.
  • The image is PNG rather than JPEG: Check the output extension and set type: 'jpeg' explicitly. Playwright infers format from the path when a path is supplied.
  • The image looks too compressed: Increase the JPEG quality value toward 100. The accepted range is 0–100; quality is not a PNG setting.
  • A transparency option has no effect: JPEG cannot preserve transparency, and omitBackground does not apply to JPEG.

Or skip the browser setup

ScreenshotNeo can return a screenshot from one GET request, without installing or launching a browser in your project. Set an API key and target URL in the command below; see the ScreenshotNeo API documentation for request options.

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

ScreenshotNeo accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks and 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 AI agents 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.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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

Source

Playwright’s documented screenshot options and behavior are described in its Page API documentation.

Frequently Asked Questions

Can I save the screenshot as .jpg instead of .jpeg?

Yes. Playwright supports JPEG, and its screenshot format is inferred from the output file extension when you provide a path. You can also set type: 'jpeg' explicitly.

Can Playwright return the JPEG without creating a file?

Yes. Omit path from page.screenshot(); the method returns an image buffer instead.

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.

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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.