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

Control images in a web capture by choosing the control that matches your goal: intercept and abort image requests before navigation when images must not download, change rendered appearance at screenshot time when they should simply be hidden or restyled, or wait for specific image and lazy-loading conditions when the capture must include them. Playwright supports viewport, full-page and element screenshots, so scope matters as much as image handling.

Choose the image control you actually need

“Control images” can mean three different operations. They should not be treated as interchangeable:

Goal Playwright technique Important consequence
Prevent image downloads Route requests and abort those whose resource type is image, before navigation The page may show blank image areas, broken-image styling or a different layout.
Hide or restyle images only in the output Use screenshot-time styling (or CSS injected for the capture) Network requests can still occur; this changes appearance, not downloading.
Ensure required images appear Wait for the particular image/content state, and trigger lazy loading when necessary load does not prove that every lazy resource is rendered.

Playwright’s request-routing guidance documents aborting image requests, while its screenshot API documents styling, output formats and capture scope. See the network documentation, Page API and Locator API.

Block image downloads before the page loads

Install Playwright and a browser, then register routing before calling goto. The handler below blocks every request identified as an image, including formats that do not end in .png or .jpg.

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
npm install playwright
npx playwright install chromium
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });

  await page.route('**/*', async route => {
    if (route.request().resourceType() === 'image') {
      await route.abort();
    } else {
      await route.continue();
    }
  });

  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  await page.screenshot({ path: 'without-images.png', fullPage: true });
  await browser.close();
})();

Routing must be configured before navigation so requests are intercepted as they occur. A URL-extension filter alone is incomplete: responsive images, CDN URLs, query-string variants and data-driven image endpoints may not end in a familiar extension. Resource type is the more general rule for ordinary browser image requests.

Block selected images instead of all images

Use the request URL or page context when only a particular asset or host should be stopped:

await page.route('**/*', async route => {
  const request = route.request();
  const shouldBlock = request.resourceType() === 'image'
    && request.url().includes('tracking-cdn.example');
  await (shouldBlock ? route.abort() : route.continue());
});

Keep the predicate narrow when the page needs hero images, product photos or icons for layout. Blocking a request changes page behavior, so compare the resulting capture with an unblocked version before using it for visual regression or documentation.

What blocking does to layout

An image can reserve space through intrinsic dimensions, CSS aspect-ratio or a fixed container; it can also determine container height only after it loads. Aborting it may leave an empty box, collapse a region, expose an alternative background, or change text wrapping. That is expected network behavior, not a screenshot bug. If the objective is merely to remove visual clutter while preserving layout, use capture-time styling instead.

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

Hide or change rendered images without blocking requests

Screenshot styling is the right separation when a page must finish its normal loading process but the output should omit images. The Page screenshot API accepts a style applied while the screenshot is taken:

await page.screenshot({
  path: 'images-hidden.webp',
  type: 'webp',
  style: `
    img, picture, svg image, video {
      visibility: hidden !important;
    }
  `
});

visibility:hidden preserves layout space. Use display:none when you intentionally want surrounding content to reflow:

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
await page.screenshot({
  path: 'images-removed.png',
  style: `img, picture, svg image { display: none !important; }`
});

These styles do not stop network downloads. They are useful for a clean documentation shot, a text-focused visual test, or a redacted preview. If you need a stable placeholder, replace the image appearance rather than removing its box:

await page.screenshot({
  path: 'placeholders.png',
  style: `
    img { visibility: hidden !important; }
    img::after { content: ''; }
    figure { background: #e5e7eb !important; }
  `
});

Generated content on replaced elements such as img is inconsistent across browsers; style the containing figure, wrapper or known component for dependable placeholders.

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

Capture the correct area

Viewport screenshot

A normal page screenshot captures the current browser viewport. Content below the fold is omitted:

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

Full-page screenshot

Set fullPage: true to capture the page’s full scrollable height:

await page.screenshot({ path: 'full-page.png', fullPage: true });

Full-page capture does not guarantee that lazy images have loaded. Trigger the state your page uses, then wait for the relevant elements before taking the shot.

One component or region

A locator screenshot targets one element:

const card = page.locator('[data-testid="pricing-card"]');
await card.screenshot({ path: 'card.png' });

For a scrollable element, the locator screenshot shows the content currently visible inside that element. Scroll the element first if the required portion is not on screen:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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 card.evaluate(el => { el.scrollTop = el.scrollHeight; });
await card.screenshot({ path: 'card-bottom.png' });

Use a stable selector rather than a generated class. If no matching element exists, Playwright waits and eventually reports a timeout, which is preferable to silently capturing the wrong region.

Wait for images and lazy content deliberately

The page load event is not a universal “everything needed for this capture is ready” signal. Modern sites fetch data and images after that event, often when content enters the viewport. Playwright’s navigation guidance recommends waiting for the intended state rather than treating networkidle as a general readiness test; see navigation documentation.

Wait for a specific image

const hero = page.locator('img[alt="Product overview"]');
await hero.waitFor({ state: 'visible' });
await hero.evaluate(img => {
  if (!img.complete) {
    return new Promise(resolve => {
      img.addEventListener('load', resolve, { once: true });
      img.addEventListener('error', resolve, { once: true });
    });
  }
});
await page.screenshot({ path: 'hero-ready.png' });

The code waits for the element and then allows either a successful load or an error to settle. If an error must fail the job instead, inspect img.naturalWidth and throw when it is zero.

Trigger lazy loading by scrolling

await page.evaluate(async () => {
  await new Promise(resolve => {
    let y = 0;
    const step = 700;
    const timer = setInterval(() => {
      window.scrollBy(0, step);
      y += step;
      if (y >= document.documentElement.scrollHeight) {
        clearInterval(timer);
        resolve();
      }
    }, 100);
  });
});
await page.waitForTimeout(500);
await page.screenshot({ path: 'lazy-loaded.png', fullPage: true });

Scrolling is practical for sites that load as content enters the viewport, but it is not a guarantee: an application may use an intersection observer, explicit API calls or another trigger. Verify the page’s actual condition. A selector wait is usually more reliable than an arbitrary delay:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.locator('[data-images-ready="true"]').waitFor();

Use network idle carefully

waitUntil: 'networkidle' can be useful for a page you control, but analytics, polling and advertisements may keep connections open indefinitely. Prefer a semantic readiness marker, a visible component, or an assertion about the image state. Do not use a fixed delay as proof that a resource loaded.

Output format, quality and pixel scale

Playwright can write PNG, JPEG or WebP. JPEG and WebP support quality settings; PNG is lossless and does not use a quality value:

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
await page.screenshot({
  path: 'capture.webp',
  type: 'webp',
  quality: 82,
  scale: 'css'
});

scale: 'css' keeps one output pixel per CSS pixel; scale: 'device' uses the device scale factor and produces a larger, denser image. Choose one deliberately when comparing files or publishing them, otherwise screenshots from different contexts can have different dimensions. For JPEG, omit transparency expectations: JPEG has no alpha channel. Use PNG or WebP when a transparent background is required by your workflow.

A complete decision workflow

  1. Define the result. Decide whether images must not be downloaded, must be invisible in the output, or must be present and fully rendered.
  2. Choose scope. Select viewport, full page or a locator. For an element with its own scroll area, scroll it to the required position.
  3. Set the browser context. Fix viewport, device scale, color scheme and any authentication before navigation so layout is reproducible.
  4. Install routing early. Add image-abort rules before goto if download prevention is the requirement.
  5. Navigate and wait for intent. Use a selector, image state or application-ready marker. Trigger lazy loading if the page requires it.
  6. Apply capture-only styling. Hide or restyle images only after the page state is ready, and remember that this does not reduce downloaded bytes.
  7. Capture and validate. Check dimensions, expected regions, image errors and the output format. Save a diagnostic screenshot or trace when a run fails.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting image-controlled captures

Images still appear after routing

Check that the route was registered before navigation and that the predicate tests resourceType() === 'image'. Images embedded as CSS backgrounds, data URLs or canvas drawing may not generate ordinary image requests. Add a targeted CSS rule or application-level hook for those cases.

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

The page layout collapses when images are blocked

The page probably relies on intrinsic image dimensions or loaded content to establish height. Preserve a wrapper’s dimensions with CSS, block only nonessential hosts, or switch to visibility:hidden styling so the image box remains in layout.

The full-page shot contains blank lazy images

Scroll through the page, wait for the site’s readiness marker, and verify each required image’s complete and naturalWidth. A load event alone may occur before application-rendered image URLs are assigned.

A locator screenshot times out

The selector may be unstable, hidden behind a consent dialog, inside a frame, or rendered only after an interaction. Use a stable test ID, handle the correct frame, accept or dismiss the dialog, and wait for the component’s visible state.

Network-idle waiting never finishes

Long polling, analytics or third-party widgets can keep requests active. Replace network-idle waiting with a specific selector, an application-ready flag or an image assertion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Output dimensions differ between machines

Set an explicit viewport and choose scale: 'css' or scale: 'device' consistently. Also fix the browser, device scale factor, fonts and color scheme when pixel-level comparisons matter.

Blocking images causes bot or consent screens

Some sites alter their response or render a challenge when request patterns change. Do not assume an image-blocked capture represents the normal visitor experience; record the page verdict and handle the site’s permitted automation flow.

Or skip the browser setup

ScreenshotNeo provides a single HTTP request for PNG, JPEG, WebP or PDF captures. It removes cookie and consent banners, newsletter popups and chat widgets before the shot; bot checks, blank pages, failed loads, timeouts and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Every plan includes the full feature set, including full-page capture with lazy images loaded, CSS-selector element capture, custom CSS and JavaScript, waits, request and resource blocking, cookies and headers, device and retina controls, PDF options, caching and bulk capture.

See the ScreenshotNeo documentation for all parameters. A one-call cURL example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free. Create a free ScreenshotNeo account to try it.

Cost, reliability and operational notes

  • Blocking image requests can reduce transfer and rendering work, but it changes the page you are measuring; do not compare it directly with a normal visitor capture.
  • Capture-only CSS preserves normal loading behavior but does not save image bandwidth.
  • Full-page jobs are more sensitive to lazy loading, sticky headers and infinite-scroll behavior than viewport shots.
  • For repeatable output, pin browser versions where practical, set explicit viewport and scale, and wait on semantic page state.
  • When a capture is used in a pipeline, retain the URL, options, browser context and failure reason so a blank or challenge page is distinguishable from a valid image-free result.

FAQ

Frequently Asked Questions

Can I block only PNG and JPEG files?

Yes, but resource-type routing is broader and catches image URLs without those extensions. Use a URL predicate only when you intentionally want to limit the rule.

Does hiding an image with CSS make the request free of network cost?

No. Screenshot styling changes the rendered output; it does not prevent the browser from requesting the image.

Which capture mode is best for a single chart?

Use a locator screenshot for the chart’s element. Use a viewport shot for what a user currently sees and full-page only when below-the-fold content is required.

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

Why are some images missing even though the page says it is loaded?

They may be lazy-loaded or inserted after navigation. Trigger the relevant viewport state and wait for the application’s specific image-ready condition.

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.