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

Use Playwright’s Python API to open each project URL at a fixed viewport and save a screenshot as an image. For consistent portfolio cards, capture the viewport rather than the entire page, keep the viewport and scale consistent, and use full-page captures only when the complete page is useful to show. The examples below use Playwright’s synchronous API, with options for element captures, output formats, and repeatability.

Install Playwright and prepare a project list

Playwright’s Python library offers synchronous and asynchronous APIs. The synchronous API is a simple fit for a standalone batch script; use the asynchronous API if your surrounding application already uses asyncio. See the Playwright library getting-started guide.

  1. Install the Python package: pip install playwright.
  2. Install a browser supported by Playwright: playwright install chromium.
  3. Save the script below as make_thumbnails.py, then run it with python make_thumbnails.py.

The example creates an output directory and captures each URL in the list using the same viewport. Replace the example URLs with your portfolio projects.

from pathlib import Path
from playwright.sync_api import sync_playwright

PROJECTS = [
    ("project-one", "https://example.com"),
    ("project-two", "https://example.org"),
]

OUTPUT_DIR = Path("thumbnails")
VIEWPORT = {"width": 1440, "height": 900}


def main():
    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)

    with sync_playwright() as playwright:
        browser = playwright.chromium.launch()
        context = browser.new_context(viewport=VIEWPORT)
        page = context.new_page()

        for name, url in PROJECTS:
            try:
                response = page.goto(url, wait_until="load", timeout=30_000)
                if response is not None and response.status >= 400:
                    print(f"{name}: HTTP {response.status}; capturing page anyway")

                page.screenshot(path=str(OUTPUT_DIR / f"{name}.webp"), type="webp")
                print(f"Saved {OUTPUT_DIR / f'{name}.webp'}")
            except Exception as error:
                print(f"Could not capture {name} ({url}): {error}")

        context.close()
        browser.close()


if __name__ == "__main__":
    main()

The script uses a fixed 1440 × 900 CSS-pixel viewport as an example, not a required portfolio size. Choose dimensions that suit your card design and keep them consistent across the batch. A navigation response with an HTTP error status does not necessarily prevent a screenshot, so the example reports the status and still captures the page; change that behavior if you prefer to skip error pages.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose what each portfolio thumbnail should show

Capture the viewport for compact cards

page.screenshot(path="thumb.png") captures the current page view. This usually produces a landscape image that fits a portfolio grid more naturally than a long full-page image. The Playwright Screenshots documentation describes viewport and full-page captures.

Capture the full page when the whole design matters

Set full_page=True to capture the entire scrollable page: page.screenshot(path="full.png", full_page=True). The output can be very tall, so it is often better for project documentation or a detail view than for a compact card. Full-page capture does not automatically make a good thumbnail; consider whether the portfolio layout will display the resulting height usefully.

Capture one element instead of the entire page

Use a locator screenshot when you want a matching component, such as a hero section or project preview:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
hero = page.locator(".hero")
hero.screenshot(path="hero.webp", type="webp")

The locator must match the intended element. Playwright scrolls it into view before capture. A locator screenshot of a scrollable container shows only the content currently scrolled into view, not the container’s entire scrollable contents. See the Locator API documentation.

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

Set viewport, device profile, and image output

Match the intended presentation

Set a context viewport explicitly instead of relying on defaults. For a mobile portfolio preview, use a smaller viewport or a Playwright device profile. Playwright supports device emulation, viewport overrides, and device scale factors; the Emulation guide explains the available settings. Pick the presentation target your portfolio needs rather than mixing desktop and mobile captures unintentionally.

Choose the format and scale

Locator screenshot options document PNG, JPEG, and WebP. PNG is lossless; JPEG and WebP support a quality setting, which trades some image detail for a smaller file. The scale option accepts "css" (one output pixel per CSS pixel) or "device" (output pixels follow the device scale factor). These choices affect appearance and file size, so check the result at the size visitors will see.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
page.locator(".hero").screenshot(
    path="hero.webp",
    type="webp",
    quality=82,
    scale="css",
)

The quality option applies to JPEG and WebP, not PNG. WebP screenshot support is version-dependent: Playwright’s release notes describe its introduction in Python version 1.62. Check your installed Playwright version and the current release notes if the option is unavailable; browser versions listed in release notes can change over time.

Make captures more consistent

Web pages can change between captures because of animation, rotating content, timestamps, popups, or delayed assets. Playwright documents screenshot options to disable CSS animations and apply screenshot-specific styles. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.screenshot(
    path="stable.png",
    animations="disabled",
    style=".cookie-banner, .newsletter-modal { visibility: hidden !important; }",
)

Use selectors that match the target site and the purpose of the image; hiding a dialog can also hide content a viewer should see. Screenshot styling and animation control can reduce some sources of variation, but do not guarantee identical rendering across all sites or runs.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

For pages that load important content after navigation, wait for an element that signals the content is ready before capturing:

page.goto(url, wait_until="load", timeout=30_000)
page.locator("main").wait_for(state="visible", timeout=10_000)
page.screenshot(path="thumb.png")

Choose a meaningful selector for each site where possible. A generic delay can be less reliable: it may wait too long on fast pages and still capture too early on slow ones.

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

Save screenshot bytes for further processing

Providing path writes the image to a file. If you omit it, Playwright returns the screenshot as bytes, which you can pass to an image-processing step or store using your own logic:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
image_bytes = page.screenshot(type="png")
# Pass image_bytes to the next step in your own pipeline.

Use a path for a straightforward portfolio asset-generation script; use bytes when another part of your application needs to process or transmit the image without an intermediate file.

Common failures and practical fixes

  • Browser executable is missing: install the browser for the Playwright package with playwright install chromium. If you update Playwright, install its supported browser binaries again as needed.
  • Navigation times out: the site may be slow, blocked, or waiting on resources that never finish. Increase the timeout for known slow sites, or use a narrower readiness condition such as waiting for a visible page element rather than requiring every resource to finish.
  • The screenshot is blank or incomplete: confirm the URL is correct and the page has loaded the content you need. Wait for a relevant selector before capture; for lazy-loaded content, consider whether scrolling or a full-page capture is required for the intended image.
  • A selector capture fails: check that the locator matches an element on that page and is visible. Sites may use different markup, so a selector that works for one project may not work for another.
  • Output looks too tall or too small: decide between viewport and full-page capture, then review viewport dimensions and CSS/device scale. A full-page screenshot is not a substitute for selecting a card-friendly viewport.
  • WebP is rejected or unsupported: check the installed Playwright version and browser support. Use PNG or JPEG when that better fits the required output.
  • Cards differ visually from run to run: disable animations and apply narrowly targeted screenshot styles where appropriate; delayed or personalized content can still vary by site.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. For a quick capture, save the response to a file:

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 response details. ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

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

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Frequently Asked Questions

Does a Playwright page screenshot include the entire page by default?

No. A standard page screenshot captures the current viewport; set full_page=True to capture the full scrollable page.

Can Playwright return an image without saving it to disk?

Yes. Omit the screenshot path argument and the API returns image bytes.

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.