The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →To control images in a Playwright web capture, decide whether you want to stop image files from downloading, change what appears in the screenshot, or make sure images have loaded before capture. Use request routing before navigation to block downloads; use screenshot styling or a locator to change or limit what is captured; and wait for the specific image or page content your capture needs. Those controls solve different problems.
Choose the right kind of image control
| Your goal | Playwright approach | Important trade-off |
|---|---|---|
| Prevent image resources from downloading | Route image requests and abort them before navigating. | The page may show blank image areas or change layout. Playwright’s network documentation demonstrates blocking PNG and JPEG requests. |
| Change or hide rendered content only in the screenshot | Apply screenshot styling. | This changes capture-time appearance; it does not itself prevent image downloads. See the Page screenshot API. |
| Capture only a particular region | Take a locator screenshot. | A scrollable element capture shows its currently visible, scrolled content. See the Locator screenshot API. |
| Ensure required images appear | Wait for the relevant image or content state, and trigger lazy-loaded content as needed. | The page load event does not guarantee that every later or lazy-loaded resource is ready. See Playwright navigation guidance. |
These options are not interchangeable. Routing changes network behavior. Screenshot styling changes appearance at capture time. The capture method determines the area in the output, and explicit waits determine whether the content you need is ready.
Block image downloads before navigation
Set up a route handler before calling page.goto(), so it can intercept image requests as they happen. This Python example aborts requests Playwright identifies as image resources:
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
async def handle_route(route):
if route.request.resource_type == "image":
await route.abort()
else:
await route.continue_()
await page.route("**/*", handle_route)
await page.goto("https://example.com", wait_until="domcontentloaded")
await page.screenshot(path="without-images.png", full_page=True)
await browser.close()
asyncio.run(main())
Replace https://example.com with the page you need. The handler allows non-image requests through and aborts requests whose resource type is image. Resource-type routing is broader than matching only file extensions: an image request does not have to end in .png or .jpg.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →#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
Aborting a request can leave an image element empty, but the result depends on the page’s markup, styles, and layout behavior. If you need the page to retain its layout while hiding images only in the output, use screenshot styling instead of blocking requests.
Limit blocking to selected image URLs
If you need some images to load, add a URL condition to the handler rather than aborting every request of type image. For example, the following blocks images from one host and allows others:
async def handle_route(route):
request = route.request
if request.resource_type == "image" and "images.example.net" in request.url:
await route.abort()
else:
await route.continue_()
For production code, use a URL parser and compare the request’s hostname instead of relying on a substring if the match must be precise. Confirm that the host condition covers the actual image URLs used by the page.
Hide or alter images only in the screenshot
When the images should not appear in the output but you do not need to block their downloads, Playwright’s screenshot API supports capture-time styling. For example, hide image elements in the screenshot:
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
await page.screenshot(
path="without-images.png",
full_page=True,
style="img { visibility: hidden !important; }"
)
Capture styling is useful when the browser should render the page normally but the final screenshot should omit or adjust selected content. It is separate from routing: the request may still be downloaded even though the image is hidden in the screenshot. Consult the current Page API for the supported screenshot options in the Playwright version you use.
For more selective changes, target a page-specific selector in the style rather than every img. CSS rules affect the rendering at capture time, so check whether hiding an element with display: none changes surrounding layout; visibility-based hiding typically preserves the element’s space.
Choose viewport, full-page, or element capture
Viewport screenshot
A regular page screenshot captures the visible browser page area. Use it when the desired image is the current viewport and below-the-fold content is not needed. The Page screenshot API documents page screenshots and full-page capture.
Full-page screenshot
Set full_page=True in Python to capture the full scrollable page. A full-page capture does not automatically mean every lazy-loaded image has been requested and rendered; trigger and verify the content the capture requires first.
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.
Element screenshot
Use a locator when the target is one component or region:
await page.locator("article").screenshot(path="article.png")
Replace article with the CSS selector for the target. According to the Locator API, a screenshot of a scrollable element captures its currently scrolled content. Scroll the element to the desired position before capture if it contains more content than is visible at once.
Wait for images and lazy-loaded content
Navigation reaching the load event is not a universal signal that all content needed for a screenshot is ready. Modern pages can fetch data lazily or load expensive resources afterward. Playwright’s navigation documentation describes this behavior and recommends waiting for the intended page state rather than treating a general network condition as proof of readiness.
Wait for a specific image
If an image is essential, wait for that element and check its browser-side load state before capturing:
Free tools Windows power users keep installed
One-click scans. No signup required.
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
image = page.locator("img.hero")
await image.wait_for(state="visible")
await image.evaluate("img => img.decode()")
await page.screenshot(path="hero.png")
This waits for a matching visible element and asks the browser to decode its image. It does not guarantee that unrelated images elsewhere on the page are ready. Choose a selector that identifies the actual content you need; if the page swaps image sources dynamically, wait for the final expected state as well.
Trigger lazy-loaded images
For a full-page capture of content that loads as it enters the viewport, scroll through the relevant page area and wait for the content to appear before taking the screenshot. Scrolling is a practical way to trigger common lazy-loading behavior, not a guarantee for every site. Confirm that the needed content has loaded; a site may require a different interaction or may load content only under particular conditions.
Do not use network idle as a universal readiness test
Some pages keep network activity open or make requests long after the content needed for a screenshot is visible. Playwright’s Page API discourages using networkidle as a general test-readiness signal. Prefer a locator, image load condition, or other assertion tied to the state you actually need.
Output format and screenshot settings
Playwright’s screenshot API supports PNG, JPEG, and WebP. The API also documents quality and scale settings, including CSS-pixel versus device-pixel output. Use a format and scale that fit the destination: image format and quality affect file size and visual fidelity, while scale controls pixel dimensions. The right choice depends on how the capture will be displayed or stored, not on whether images were blocked from the page.
Recommended Free Tools
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.
For exact option names and current behavior, use the Page screenshot API reference. The available settings can vary by language binding and Playwright version.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common problems and fixes
Images still appear after blocking
- Cause: The route was registered after navigation, or the handler checks file extensions while the site’s image URLs use other paths.
- Fix: Register
page.route()beforepage.goto()and matchrequest.resource_type == "image"if you intend to block image resources broadly.
Large blank spaces remain
- Cause: The request was aborted, but the page still reserves space for the image or its container.
- Fix: If you want a different visual result, use screenshot styling to hide the image or adjust the relevant container. Blocking network requests alone does not define how the site lays out the empty area.
Some images are missing from a full-page screenshot
- Cause: The page had not loaded lazy content below the initial viewport when capture began.
- Fix: Scroll through the relevant areas, wait for the needed image or content state, and verify it before capturing. Scrolling behavior varies by site.
The capture waits indefinitely
- Cause: A broad readiness condition, such as waiting for all network activity to stop, does not match a page that continues making requests.
- Fix: Wait for a specific selector or image condition tied to the capture instead of treating network idle as a universal signal.
An element screenshot omits part of a scrollable region
- Cause: The locator capture shows the element’s currently scrolled content.
- Fix: Scroll the element to the desired position before capture, or capture the page full-size if that better matches the requirement.
Performance, reliability, and cost considerations
Blocking image requests can reduce the work the browser performs for those resources, but the supplied Playwright documentation does not establish a fixed speed gain or bandwidth saving; results depend on the page and its image delivery. It can also change what the page renders, so use it only when omitted downloads are acceptable. If the actual requirement is a clean screenshot rather than reduced image loading, capture-time styling or a narrower locator may preserve more of the page’s normal behavior.
For reliable automation, make the capture depend on the content you need, not a fixed assumption that navigation completion means visual completion. Handle pages with lazy loading explicitly, and use a selector specific enough to fail clearly when the expected content never appears. Screenshot format, full-page scope, and output scale should be chosen for the consumer of the file.
Or skip the browser setup
If your goal is a screenshot rather than managing a browser, ScreenshotNeo is a website screenshot API and MCP server. It accepts one GET request with a URL and returns a PNG, JPEG, WebP, or PDF. For example, this cURL request saves a WebP screenshot:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options and setup. Cookie banners are accepted and removed before the shot, along with known newsletter popups and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies 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 MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Does blocking images also hide CSS background images?
The example routes requests identified by Playwright as image resources. Whether a particular background image is intercepted depends on how the browser classifies and requests that resource; verify the target page’s actual behavior.
Can I block only PNG and JPEG files?
Yes. Use URL or resource conditions in the route handler to select the formats you want to abort, while allowing other requests through. A resource-type condition is preferable when file extensions do not reliably identify image requests.
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.

