PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteFastAPI can expose a screenshot endpoint by combining an async Playwright browser with a route that accepts a URL and returns image bytes. Install both the Python package and its browser binaries, validate destinations, choose viewport or full-page capture, and close browser resources. For a hosted implementation, ScreenshotNeo provides a URL-to-image API without requiring you to run Chromium.
What you will build
The example below accepts a JSON object containing a page URL, opens it in Chromium through Playwright, captures either the visible viewport or the complete scrollable page, and returns PNG, JPEG, or WebP bytes from FastAPI. It is an educational starting point rather than a production deployment recipe: the available FastAPI material does not establish a universal browser-pooling, concurrency, deployment, or user-supplied URL security design.
Choose the capture approach
| Approach | What runs | Useful when | Important qualification |
|---|---|---|---|
| Playwright in your FastAPI process | Your application launches a supported browser and calls page.screenshot(). |
You need local control over browser settings, authentication, network access, or post-processing. | You must install browser binaries and design resource, isolation, and destination policies yourself. |
| Hosted screenshot API | Your endpoint forwards a URL and receives image bytes or a stored-image URL. | You want to avoid managing browser installation and rendering infrastructure. | The provider’s authentication, request fields, limits, and delivery behavior apply. Vendor examples should be checked against the provider’s current documentation. |
For a service alternative, ScreenshotNeo is the first option to try: it removes common consent banners, popups, and chat widgets before capture, bills only clean shots, and has a $5 paid plan for 3,000 shots.
Install FastAPI, Uvicorn, and Playwright
Playwright requires the Python package and its supported browser binaries. Installing only your FastAPI application will not provide a browser to render pages.
python -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows PowerShell: .venvScriptsActivate.ps1
python -m pip install fastapi uvicorn playwright
python -m playwright install chromium
Use a Playwright-supported Python environment and ensure the operating system has the dependencies required by the selected browser. In a container or minimal Linux image, follow Playwright’s installation guidance for browser system packages rather than assuming the base image is ready.
#1 Best Overall
- 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.
Minimal asynchronous FastAPI screenshot endpoint
This version launches one browser for the application lifetime, creates a fresh context and page per request, and returns bytes directly. The lifespan pattern avoids launching a new browser process for every call while still isolating cookies and page state between requests.
from contextlib import asynccontextmanager
from typing import Literal
from urllib.parse import urlparse
from fastapi import FastAPI, HTTPException
from fastapi.responses import Response
from pydantic import BaseModel, Field
from playwright.async_api import async_playwright, TimeoutError as PlaywrightTimeoutError
class ScreenshotRequest(BaseModel):
url: str = Field(min_length=1)
full_page: bool = False
format: Literal["png", "jpeg", "webp"] = "png"
quality: int | None = Field(default=None, ge=0, le=100)
width: int = Field(default=1280, ge=320, le=4000)
height: int = Field(default=720, ge=240, le=4000)
def validate_url(value: str) -> str:
parsed = urlparse(value)
if parsed.scheme not in {"http", "https"} or not parsed.netloc:
raise HTTPException(status_code=400, detail="url must be an absolute HTTP(S) URL")
# Add an allowlist, DNS/IP policy, and egress controls before exposing this
# endpoint to untrusted callers. This example does not implement SSRF defense.
return value
@asynccontextmanager
async def lifespan(app: FastAPI):
playwright = await async_playwright().start()
browser = await playwright.chromium.launch()
app.state.playwright = playwright
app.state.browser = browser
try:
yield
finally:
await browser.close()
await playwright.stop()
app = FastAPI(lifespan=lifespan)
@app.post("/screenshot")
async def screenshot(request: ScreenshotRequest):
url = validate_url(request.url)
browser = app.state.browser
context = await browser.new_context(
viewport={"width": request.width, "height": request.height}
)
page = await context.new_page()
try:
await page.goto(url, wait_until="load", timeout=30_000)
options = {
"full_page": request.full_page,
"type": request.format,
}
if request.quality is not None and request.format != "png":
options["quality"] = request.quality
image = await page.screenshot(**options)
media_type = {
"png": "image/png",
"jpeg": "image/jpeg",
"webp": "image/webp",
}[request.format]
return Response(content=image, media_type=media_type)
except PlaywrightTimeoutError:
raise HTTPException(status_code=504, detail="page navigation timed out")
finally:
await context.close()
Run it with:
uvicorn main:app --reload
Then call it:
curl -X POST http://127.0.0.1:8000/screenshot
-H 'content-type: application/json'
-d '{"url":"https://example.com","full_page":true,"format":"webp"}'
-o example.webp
The route returns the image itself, so clients should inspect the HTTP status and content-type before saving the body. If your application needs a durable URL instead, write the bytes to object storage and return a JSON record containing that URL; the exact storage and response contract is an application decision.
Playwright capture options that matter
Viewport versus full page
By default, the screenshot represents the configured viewport. Set full_page=True to capture the full scrollable page. Full-page rendering can produce a very tall image and may trigger additional lazy-loading work; set a practical maximum for your workload.
PNG, JPEG, and WebP
The Page API supports PNG, JPEG, and WebP. PNG is lossless and does not use a quality setting. JPEG and WebP accept a quality value from 0 through 100 in the example. Choose PNG for crisp UI or text, and a lossy format when smaller responses matter.
CSS pixels and device pixels
The width and height values above define the viewport in CSS pixels. Playwright’s screenshot API also exposes a scale option that distinguishes CSS-pixel output from device-pixel output; use the documented scale setting when you need a retina-style image rather than silently increasing the viewport.
Rank #2
- 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.
Element screenshots
To capture one component instead of the page, locate it and call its screenshot method:
card = page.locator("article.product-card").first
image = await card.screenshot(type="png")
A missing selector raises an error, so return a clear 404 or 422 response after checking whether the locator resolves. You can also omit path; Playwright then returns screenshot bytes, which is what the FastAPI response uses.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Waiting, masking, and timing
page.goto() waiting for load is a starting point, not a guarantee that a JavaScript application has finished rendering. For a known application, wait for a selector or a deliberate state before capturing:
await page.goto(url, wait_until="domcontentloaded", timeout=30_000)
await page.locator("main[data-ready='true']").wait_for(timeout=15_000)
image = await page.screenshot(full_page=True, type="png")
Playwright also documents screenshot controls for masking sensitive or unstable regions and for clipping to a defined rectangle. Apply those options only when your endpoint’s request model explicitly permits them.
Protect an endpoint that accepts URLs
A URL screenshot route is a server-side fetcher. The simple scheme check in the example prevents obvious non-HTTP input but is not a complete security policy. Before exposing it to untrusted users, decide which destinations are allowed and how the service handles redirects, DNS resolution, private address ranges, credentials, response size, navigation time, downloads, and outbound network access. Add authentication and rate limits appropriate to your application. The supplied sources do not establish a single FastAPI-approved SSRF or deployment recipe, so treat these as design and security work rather than a solved framework setting.
Rank #3
- 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.
Do not place secrets in arbitrary destination URLs. Use a controlled mechanism for cookies or authorization headers, and avoid returning pages that contain another user’s authenticated data. Consider whether JavaScript, third-party requests, and downloads should be blocked for your use case.
Returning a stored URL instead of bytes
If consumers need to embed images repeatedly, save the returned bytes under an application-generated key and respond with JSON. A typical response shape is:
{"url":"https://media.example.test/screenshots/abc123.webp","format":"webp"}
The hosted-service model documented by Screenshot API similarly describes a request containing a URL and format, followed by either a CDN URL or downloadable bytes. Its example is vendor documentation; its request fields, authentication, availability, and terms should be confirmed before production use.
Or skip the browser setup
ScreenshotNeo accepts one GET request and returns a PNG, JPEG, WebP, or PDF. The API can handle full-page captures with lazy images, CSS-selector element captures, dark mode, device presets or custom viewports, retina scale, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits, blocked ads or resource types, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Every feature is available on every plan.
Use the ScreenshotNeo API documentation for the current parameter reference. A minimal call from your FastAPI server can stream the result or save it:
Rank #4
- 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
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)
r.raise_for_status()
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(`Screenshot failed: ${res.status}`);
const bytes = Buffer.from(await res.arrayBuffer());
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 cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
| Plan | Included shots | Price |
|---|---|---|
| Free | 1,000 per month | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Yearly billing gives two months free. Start with 1,000 free screenshots each month—no card required.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting
“Executable doesn’t exist” or browser launch failure
Install the browser binaries with python -m playwright install chromium. In a minimal container, install the operating-system dependencies required by Chromium as well.
Navigation timeout
The destination may be slow, blocked, or waiting on resources that never finish. Set an explicit timeout, use an appropriate wait_until value, and return HTTP 504 rather than an image containing an unknown partial state. Do not increase timeouts without a workload limit.
Recommended Free Tools
Blank or incomplete image
Wait for an application-specific selector, allow lazy content to load, or use full-page capture. A load event alone does not prove that client-side rendering has completed.
Element not found
Check the selector against the exact page and frame, wait for it, and return a controlled error when it is absent. Avoid accepting arbitrary selectors from untrusted callers unless you have considered information disclosure.
Best Value
- 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.
Memory growth or too many browser processes
Close every context in a finally block, cap concurrent requests, and monitor browser memory. The sources do not provide a tested pooling or worker configuration, so measure your own workload before selecting one.
Unexpected private-network access
Do not rely on the scheme check as SSRF protection. Enforce an allowlist or egress policy and account for redirects and DNS rebinding before accepting public requests.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsTesting checklist
- Capture a fast static page and verify the response media type.
- Compare viewport and
full_pageoutput on a long document. - Exercise PNG, JPEG, and WebP, including the rule that PNG ignores quality.
- Test a missing selector and a deliberately slow page.
- Confirm browser and context cleanup after both success and exceptions.
- Verify authentication, destination policy, rate limits, and maximum image size before deployment.
FAQ
Can FastAPI itself render a webpage?
No. FastAPI handles HTTP; Playwright or a hosted rendering service performs browser capture.
Can I return screenshot bytes without creating a file?
Yes. Omitting Playwright’s file path returns bytes, which can be passed directly to a FastAPI response or another processing step.
Does full-page capture automatically wait for every lazy image?
Not necessarily. Full-page mode changes the capture area; use an application-specific wait or a service option designed to load lazy images when that distinction matters.
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.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →

