To save a website screenshot with Crawl4AI, enable screenshot=True in a CrawlerRunConfig, call AsyncWebCrawler.arun(), then base64-decode result.screenshot and write the resulting bytes to a PNG file. The returned screenshot is an optional base64-encoded PNG string, not a file path or ready-to-save image bytes. Crawl4AI’s Crawler Result documentation and its SDK documentation describe this workflow.
Capture and save a screenshot
Use a run configuration for screenshot settings. This example checks both crawl success and whether a screenshot was returned before writing the image:
import asyncio
import base64
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig
async def main():
run_config = CrawlerRunConfig(screenshot=True)
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(
"https://example.com",
config=run_config,
)
if result.success and result.screenshot:
image_bytes = base64.b64decode(result.screenshot)
with open("page.png", "wb") as image_file:
image_file.write(image_bytes)
else:
print("Crawl or screenshot failed:", result.error_message)
asyncio.run(main())
Replace https://example.com with the page to capture. The output path is relative to the directory from which you run the script; change page.png to an absolute path or another filename if needed. The binary write mode ("wb") preserves the decoded PNG data.
Choose when and how much of the page to capture
A screenshot taken before a page has finished rendering may omit content that appears later. Crawl4AI’s run configuration supports a readiness condition and screenshot delay; the parameter reference also documents viewport-only capture and settings for long pages. See the complete SDK documentation and browser, crawler, and LLM configuration reference for the current parameter details.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →#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.
| Need | Setting or output | What it does |
|---|---|---|
| Wait for a page element or condition | wait_for |
Waits for a CSS selector or JavaScript expression before capture. |
| Add time immediately before the screenshot | screenshot_wait_for |
Adds a delay before the screenshot. A delay is not a guarantee that every page is fully rendered. |
| Capture only the visible browser area | force_viewport_screenshot=True |
Requests a viewport-only screenshot rather than a full-page capture. |
| Handle unusually tall content | screenshot_height_threshold |
Provides a threshold setting relevant to unusually tall screenshots. |
| Allow time between scrolling steps | scroll_delay |
Sets delays between scrolling steps when scanning or capturing a full page. It is relevant when content loads as the page scrolls. |
For example, a page that inserts a chart after loading may need a selector or JavaScript readiness condition that corresponds to the chart being present. A fixed delay can help with timing, but cannot reliably account for every network or application state.
Viewport, full page, PDF, or MHTML?
Viewport screenshot
Use force_viewport_screenshot=True when the visible browser area is all you need, such as a screenshot of a page header or the current screen. It avoids asking for the entire document in one image.
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.
Full-page screenshot
For a long page, consider how it loads below the fold. Crawl4AI documents scroll_delay for time between scrolling steps and screenshot_height_threshold for unusually tall pages. Tune these to the site instead of assuming an immediate capture or a single fixed wait will include every lazy-loaded element.
PDF for very long or complex pages
Crawl4AI’s advanced features guide cautions that traditional full-page screenshots of large or complex pages can be slow or error-prone, and suggests PDF export as a more reliable option for very long pages. PDF data is returned separately as result.pdf. The guide also says requesting both a PDF and screenshot converts the first PDF page into an image; that is not equivalent to getting a single image of the complete PDF.
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.
MHTML for page archiving
MHTML capture preserves a page together with its resources for archiving or offline viewing. It is a different output format, not a screenshot image. The Crawler Result documentation describes MHTML alongside screenshot and PDF capture.
Use the current configuration pattern
For screenshot settings, put run-specific options in CrawlerRunConfig and pass it to arun() as shown above. Crawl4AI documentation says older direct arguments to arun() remain accepted for backward compatibility, but recommends moving run-specific settings into the configuration object. The exact parameters available can vary with the installed Crawl4AI version; consult the documentation matching your version if an option is not recognized.
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
Troubleshoot missing or unusable screenshots
result.screenshotis empty or absent: Checkresult.successand printresult.error_message. Confirm that screenshot capture is enabled in the configuration passed to the samearun()call.- The output file contains unreadable text or is not a valid PNG: Decode the base64 string with
base64.b64decode()and write the bytes in binary mode. Do not write the encoded string directly as text. - The screenshot misses content that appears later: Add a meaningful
wait_forselector or JavaScript condition, or usescreenshot_wait_forfor an additional delay. Prefer a page-specific readiness condition when one is available. - Content near the bottom is missing: Check whether the site loads it during scrolling. Consider a full-page capture with an appropriate
scroll_delay, and account for tall-page behavior withscreenshot_height_threshold. - A very long full-page capture is slow or fails: The advanced guide identifies large and complex screenshots as a potential problem. Consider PDF output for a long document, or capture only the viewport if that meets the goal.
- A documented option is rejected: Verify the spelling and placement in the
CrawlerRunConfigfor your installed version. The current documentation favors config-based run settings; older directarun()arguments are compatibility behavior, not the recommended pattern.
Or skip the browser setup
If you want a screenshot without configuring Crawl4AI and a browser, ScreenshotNeo offers a one-request API. See the ScreenshotNeo API documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup 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 offers screenshot and page-info tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.
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.
Frequently Asked Questions
What type of image does Crawl4AI return for a screenshot?
The documented screenshot result is an optional base64-encoded PNG string.
Can I save only the visible screen instead of the full page?
Yes. Set force_viewport_screenshot=True in the run configuration for a viewport-only capture.
Is MHTML another screenshot format?
No. MHTML packages a page with its resources for archiving or offline viewing; it is distinct from an image screenshot.
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.




