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.
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
- 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. Thepathoption writes to disk; without it, the method returns an image buffer instead.- The
finallyblock 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
- 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.
Recommended Free Tools
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
- 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
- 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.
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
- 【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.
Troubleshoot common problems
- Playwright cannot find Chromium: Run
npx playwright install chromiumin 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
qualityvalue 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
omitBackgrounddoes 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.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →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.
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.




