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
image optimization

How to Reduce the File Size of Puppeteer Screenshots

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

Make Puppeteer screenshots smaller in this order: capture fewer pixels, choose a format that matches your fidelity requirements, then tune lossy quality while checking the actual bytes and visual result. Use clip or an element screenshot when you do not need the whole page; use PNG for lossless output, or a supported non-PNG format such as JPEG when some loss is acceptable. Puppeteer’s documented default is PNG, and its quality option does not apply to PNG.

Start with the pixels you actually need

Image dimensions are the first lever because every pixel belongs to the encoded image. A full-page capture can include far more content than a viewport or component screenshot. Reduce the capture area before changing compression.

Capture a rectangle with clip

Use clip when the required region has known coordinates. The rectangle uses x, y, width, and height; set scale when your Puppeteer version supports it and verify the option in the versioned API reference.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });

await page.screenshot({
  path: 'hero.png',
  type: 'png',
  clip: { x: 0, y: 0, width: 900, height: 500 }
});

await browser.close();

This omits everything outside the rectangle. The file-size benefit follows from encoding fewer pixels; Puppeteer’s documentation does not publish a universal percentage of savings.

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

Capture one element with ElementHandle.screenshot()

When the target is a component, let Puppeteer determine its bounding box instead of estimating coordinates. This is usually safer when the page is responsive or content moves.

const card = await page.waitForSelector('.product-card');
if (!card) throw new Error('Product card not found');
await card.screenshot({ path: 'product-card.png', type: 'png' });

An element screenshot excludes the rest of the page, so it is not a substitute for a full-page visual regression capture.

Use fullPage only when the whole document is required

fullPage is false by default. Enabling it captures the complete document rather than only the viewport and can substantially increase the encoded area. Keep it disabled for cards, headers, viewport tests, and other partial captures.

await page.screenshot({ path: 'viewport.png', fullPage: false });

If you genuinely need the complete page, retain fullPage: true and optimize the format and quality instead of cropping away required content.

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

Choose PNG or a lossy format deliberately

Choice Good fit Trade-off
PNG Lossless output, exact rendering, sharp text or diagrams quality does not apply; size depends on image content and captured area
JPEG or another supported non-PNG output Smaller output is worth testing and some loss is acceptable Compression artifacts can appear around text, lines and fine detail; inspect the result
Element or clipped capture Only a component or region is needed The rest of the page is intentionally omitted
Full-page capture The entire document is required More pixels are encoded than in a viewport or selected element

The current Puppeteer ScreenshotOptions reference (version 25.12.0 displayed at the time of writing) documents PNG as the default image type and describes quality as a 0–100 value that is not applicable to PNG. The reference calls the format type ImageFormat; confirm the exact supported values for the Puppeteer and Chromium versions in your project rather than assuming another automation library’s list.

JPEG example with a measured quality setting

This is an illustrative starting point, not a guaranteed best value or a tested savings percentage:

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

For screenshots dominated by photographs, gradients or large areas of color, JPEG may be a reasonable test. For UI text, code, diagrams and pixel-exact comparisons, compare the JPEG with a PNG at the intended display size. Lower quality can create ringing, blurred glyph edges and block-like artifacts.

Keep the filename and type consistent

Puppeteer can infer screenshot type from the path extension. Set type explicitly when reproducibility matters and use a matching extension, such as type: 'jpeg' with .jpg. A mismatch can make an automated pipeline confusing even when the capture succeeds.

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

A repeatable optimization workflow

  1. Define the output requirement. Decide whether transparency, lossless pixels, readable text, or the smallest practical file is the priority.
  2. Measure a baseline. Save the current image and record its byte length, dimensions and capture settings.
  3. Reduce the region. Prefer an element screenshot or a precise clip. Leave fullPage off unless the complete document is needed.
  4. Compare formats. Generate a PNG baseline and one or more supported non-PNG versions. Do not infer quality from the extension alone.
  5. Vary quality only for lossy formats. Test a small set of values, such as 90, 75 and 60, then inspect text and fine detail at the actual use size.
  6. Record the winner. Keep the smallest file that passes your visual and functional checks, along with the settings that produced it.

A simple Node.js measurement loop can report bytes without making a claim about universal savings:

import fs from 'node:fs/promises';
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });

for (const quality of [90, 75, 60]) {
  const path = `capture-${quality}.jpg`;
  await page.screenshot({ path, type: 'jpeg', quality });
  const { size } = await fs.stat(path);
  console.log(`${path}: ${size} bytes`);
}

await page.screenshot({ path: 'capture-reference.png', type: 'png' });
console.log('PNG:', (await fs.stat('capture-reference.png')).size, 'bytes');
await browser.close();

Use the same URL, viewport, device scale factor, wait conditions and capture region for every comparison. Otherwise you are measuring multiple changes at once.

Transparency, encoding and options that are often misunderstood

omitBackground is about transparency

The API documents omitBackground as hiding the default white background so transparent output is possible. It is not documented as a compression setting. Use it when downstream compositing needs alpha; do not enable it expecting a smaller file.

await page.screenshot({
  path: 'logo.png',
  type: 'png',
  omitBackground: true
});

Base64 is not image compression

An encoding: 'base64' result changes how image data is returned, not the image format or its compression settings. Base64 commonly makes the transport representation larger, so it should not be presented as a file-size optimization. Write binary data when your API or storage path permits it.

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

Do not assume optimizeForSpeed reduces bytes

The options table includes optimizeForSpeed, but the reference does not define its effect on screenshot file size. Treat it as an option requiring local measurement, not a proven size reduction technique.

Preserve fidelity while shrinking files

Text and diagrams

Small fonts, one-pixel rules and vector-like diagrams expose lossy artifacts first. Keep a PNG baseline and zoom into representative areas. If a JPEG makes text visibly soft or introduces halos, use PNG or reduce the captured region instead of lowering quality further.

Responsive pages and device scale

Capture the viewport your consumer actually needs. A retina or high device scale factor produces more pixels; it may be necessary for crisp display, but it also increases the encoded area. Compare at the final display size before sacrificing readability.

Dynamic content and reproducibility

Wait for the same page state in every run. Use a selector wait, a fixed delay, or network-idle behavior appropriate to the page, and freeze animations where your test requires deterministic pixels. A smaller file is not useful if changing content makes diffs noisy.

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

Troubleshooting common size and quality problems

The file is still large after setting quality

Check that the type is actually non-PNG. The documented quality control does not apply to PNG. Also verify that you did not leave fullPage: true enabled or capture a larger viewport than necessary. Log the output dimensions and byte length for each run.

The JPEG looks blurry or has halos

Raise the quality value, compare at the intended display size, or switch to PNG for text-heavy content. There is no documented universal quality threshold; the acceptable point depends on the image and workflow.

clip captures the wrong area

Coordinates are relative to the page. Wait for layout and fonts before measuring, account for scrolling and responsive breakpoints, and prefer an element screenshot when the target has a stable selector. Confirm the rectangle’s width and height are positive and within the rendered page.

The element screenshot is empty or missing

Verify the selector, wait for the element to appear, and ensure it is visible. Lazy content may need an additional wait for the relevant image or component before capture.

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

Transparency is unexpectedly white

Set omitBackground: true and use a format and downstream workflow that preserve transparency. Remember that this option addresses the background, not compression.

Different machines produce different byte sizes

Rendering differences, fonts, browser versions, device scale and dynamic content all affect pixels and therefore encoding. Pin the Puppeteer/Chromium environment where byte-for-byte output matters, and compare visual acceptance rather than relying only on a byte target.

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

Operational, performance and cost considerations

Capturing fewer pixels can reduce encoding work and storage, but navigation, JavaScript execution and waiting for the page often dominate total runtime. Do not remove waits merely to save bytes if that produces incomplete screenshots. For batches, measure throughput and output size together, and keep failed captures separate from accepted artifacts.

Store the capture settings with the file metadata: URL, viewport, device scale factor, full-page state, clip or selector, format, quality, Puppeteer version and timestamp. This makes a later size regression diagnosable. Because the official references publish no benchmark, report your own byte measurements with the exact page and settings instead of promising a percentage reduction.

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

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP or PDF, while options let you choose full-page or element capture, device and viewport settings, retina scale, resizing, custom CSS and JavaScript, waits, request blocking, cookies, headers, timezone, geolocation, transparency and caching. It can also submit asynchronous jobs, bulk-capture up to 100 URLs per call, and expose usage through an API. Verify option names and limits in the ScreenshotNeo documentation.

Example cURL request:

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)
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}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));

Before capture, ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server includes 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 without a card. Paid plans start at $5 for 3,000 shots; all features are available on every plan, and yearly billing gives two months free. Sign up for the free plan to try it without adding a card.

FAQ

Frequently Asked Questions

Does Puppeteer compress PNG screenshots when I set quality?

No. The ScreenshotOptions reference says the 0–100 quality setting is not applicable to PNG images.

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

Is there a guaranteed percentage reduction from switching to JPEG?

No. The official documentation provides no comparative benchmark. Measure byte size and inspect artifacts on your own pages and settings.

Should I use fullPage for every screenshot?

No. It is false by default and should be enabled only when the complete document is required.

Can I use omitBackground to make a screenshot smaller?

Use it for transparent output. Puppeteer does not document it as a file-size optimization.

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 *

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.