For a one-off screenshot that you want to save or edit as a Pillow image, start with Pillow’s ImageGrab. For repeated captures, selected monitors or regions, or pixels headed into NumPy or another processing pipeline, use MSS and benchmark it on the machine where it will run. Choose PyAutoGUI when taking a screenshot is part of desktop automation that also needs mouse, keyboard, or image-location functions. Linux users should check the active display session and available capture backend before choosing.
There is no universal fastest or best library: the right choice depends on whether you need a single image, repeated pixel access, GUI control, and what operating system and display server your program targets.
Choose by the work your script needs to do
| Library | Best fit | Important tradeoff |
|---|---|---|
| ScreenshotNeo | Capturing website pages through an API or an AI agent using an MCP client. | It captures a webpage from a URL, not the current desktop display. |
Pillow ImageGrab |
A straightforward desktop screenshot that should become a Pillow image. | Check the current reference for platform-specific behavior and requirements. |
| MSS | Repeated capture, monitor or region selection, and direct pixel-data processing. | Backend availability and performance depend on the machine and display environment. |
| PyAutoGUI | Scripts that combine screenshots with mouse, keyboard, or on-screen image-location tasks. | It is broader than a capture-only library; its documentation says it handles only the primary monitor. |
| pyscreenshot | A specific backend need, such as a supported route on some Linux/Wayland setups. | The project says it is obsolete for most cases now that Pillow supports Linux and macOS; use it only when a listed backend solves a concrete need. |
Before choosing, answer four questions: Is this capture-only or full desktop automation? Is it one image or a repeated stream? Do you want a Pillow image or pixel data for NumPy/OpenCV? Which OS, display server, and monitor arrangement will run the code?
Use Pillow ImageGrab for the simplest desktop screenshot
If Pillow is already part of your program and you need an ordinary screenshot rather than a capture loop or desktop automation, ImageGrab is the simplest starting point. It returns an image object that can be saved or passed to other Pillow operations.
Recommended Free Tools
#1 Best Overall
from PIL import ImageGrab
image = ImageGrab.grab()
image.save("screen.png")
For the supported platforms, options, and any platform-specific behavior, consult the Pillow ImageGrab reference. Confirm the behavior on the actual host, especially when deploying on Linux or in a session without a conventional interactive desktop.
When this is enough
- You need one screen capture or occasional captures.
- Your next step is saving, cropping, annotating, or inspecting a Pillow image.
- You do not need PyAutoGUI-style interaction or MSS-style pixel-buffer access.
Use MSS for repeated captures, regions, and pixel data
MSS is a good fit when you need to capture a chosen monitor or rectangular region repeatedly, or when the image should feed a pixel-processing workflow. It exposes screenshot data through pixel buffers and offers paths into Pillow and NumPy. The current usage documentation describes monitor and region capture, as well as data access as BGRA or RGB memory views, pixel tuples, and coordinate lookups.
Install the package with python -m pip install mss. For new code, the 10.2.0 release documentation prefers the mss.MSS API; older factory and class entry points are documented as deprecated or transitioning.
from mss import MSS
with MSS() as capture:
# Monitors[0] is the virtual desktop; monitors[1] is the first monitor.
monitor = capture.monitors[1]
shot = capture.grab(monitor)
print(shot.size)
print(shot.pixel(0, 0))
capture.monitors[0] represents the combined virtual desktop in the documented monitor model; entries beginning at index 1 refer to individual monitors. To capture a region, pass a mapping with the desired coordinates and dimensions:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
from mss import MSS
region = {"left": 100, "top": 80, "width": 640, "height": 400}
with MSS() as capture:
shot = capture.grab(region)
See the MSS usage documentation for the current API and data-conversion options. In a loop, create one MSS instance and reuse it rather than opening a new one for every frame:
from mss import MSS
with MSS() as capture:
monitor = capture.monitors[1]
for frame_number in range(10):
shot = capture.grab(monitor)
# Process shot before the next capture.
Converting for Pillow and NumPy workflows
The usage documentation describes integrations for Pillow and NumPy, among other processing frameworks. For downstream code, verify the channel order it expects: a buffer exposed as BGRA is not interchangeable with RGB without conversion. The alpha channel may be unused and sometimes zero-filled; ignore or remove it if a renderer or image-processing step misinterprets that channel. Follow the current conversion examples in the MSS usage reference rather than assuming that every consumer accepts the same layout.
What the published speed figures do—and do not—show
Python-MSS 10.2.0 release notes, dated 2026-04-23, report 46.2 ms per screenshot for MSS 10.1.0 and 9.48 ms for 10.2.0 in a local Debian testing, X11, 4K full-screen capture loop of 1,000 captures, using the best of three runs. These are project-reported results for that setup, not a general speed guarantee or a directly comparable test against other libraries. The same release notes say the new Linux backend can significantly reduce screenshot capture overhead. Read the MSS 10.2.0 release notes and benchmark your own target host before making a throughput decision.
The MSS usage documentation describes xshmgetimage as the default X11 Linux backend and says it is roughly three times faster than xgetimage; if MIT-SHM is unavailable, the implementation falls back to xgetimage. That is a comparison between the named backend implementations, not a universal performance comparison with Pillow or PyAutoGUI.
Use PyAutoGUI when capture belongs to GUI automation
PyAutoGUI combines screenshots with mouse and keyboard control and on-screen image-location functionality. That breadth is useful when a script needs to inspect a window, click, type, and inspect again; it is unnecessary overhead if all you need is capture-only pixel data.
Install PyAutoGUI and Pillow with python -m pip install pyautogui pillow. A basic screenshot can be saved by supplying a filename; the returned object is a Pillow image.
import pyautogui
image = pyautogui.screenshot("screen.png")
To limit the capture to a rectangular region, use the documented region tuple format:
import pyautogui
image = pyautogui.screenshot(region=(100, 80, 640, 400))
image.save("region.png")
PyAutoGUI’s documentation names Pillow as a requirement, macOS screencapture, and Linux scrot for screenshot features. Its screenshot page says a 1920 × 1080 screenshot takes “roughly 100 milliseconds”; this is approximate usage guidance on an undated documentation page, not a matched benchmark against MSS. PyAutoGUI’s documentation also says it currently handles only the primary monitor. Consult the PyAutoGUI screenshot reference and PyAutoGUI documentation for requirements and scope.
Check Linux display and Wayland backend compatibility
On Linux, the library name alone does not establish that capture will work. Determine whether the script runs under X11 or Wayland, whether it has access to the active desktop session, and which backend is installed and supported by the compositor. MSS documents X11 backends; a headless process or a session mismatch can fail even when the Python package imports correctly.
pyscreenshot’s README lists xdg-desktop-portal, GNOME Shell D-Bus, and Grim routes for certain Wayland environments. Portal dialogs may appear, and support depends on the compositor and backend. The project says it is obsolete in most cases because Pillow now supports Linux and macOS, so do not add it by default: use it only if a listed route addresses a verified environment requirement. See the pyscreenshot README and validate the route on the target machine.
Install, test, and troubleshoot on the target machine
A screenshot script depends on more than Python package installation. Use this checklist before deciding that a library is unsuitable:
- Install the selected package in the same environment that runs the script. For example, use
python -m pip install mssorpython -m pip install pyautogui pillow. - Run a minimal capture while logged into the target desktop session. Confirm that the output file exists and opens before adding image processing or automation.
- Check the display server and backend. On Linux, identify X11 versus Wayland and confirm the required backend or portal is available to that user session.
- Check monitor assumptions. PyAutoGUI documents primary-monitor-only support; for MSS, inspect its monitor list and select the intended monitor or region.
- Check image representation. If the capture succeeds but colors or alpha look wrong downstream, verify channel order and whether the alpha channel contains useful data.
Common symptoms and fixes
- Import succeeds but capture fails on Linux: check whether the process can access the active desktop, whether it is running in the expected X11 or Wayland session, and whether the required backend is installed.
- Wayland capture is unavailable or prompts unexpectedly: portal behavior and backend support depend on the compositor. Validate a documented portal, GNOME Shell D-Bus, or Grim route for that environment; do not assume one route works everywhere.
- The wrong monitor or desktop area is captured: inspect MSS monitor entries and use an explicit monitor or region. If using PyAutoGUI, account for its documented primary-monitor limitation.
- Repeated captures slow down or allocate unnecessarily: reuse one MSS instance in the loop rather than creating a new instance for each frame.
- Colors look swapped or transparent: check whether downstream code expects RGB, BGRA, or another order, and ignore or remove unused zero-filled alpha when needed.
- PyAutoGUI cannot take a Linux screenshot: check Pillow and the documented Linux screenshot setup, including
scrot, as appropriate for the installed version and environment.
Or skip the browser setup
If your task is capturing a website page by URL rather than the desktop display, ScreenshotNeo is a screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP, or PDF. It is not a replacement for Pillow, MSS, or PyAutoGUI when you need to capture the current desktop.
Best Value
For a website screenshot, the cURL request below saves a WebP capture; consult the ScreenshotNeo documentation for API options and response details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month—no card required.
Make the choice based on your capture target
Use Pillow’s ImageGrab for a simple screenshot-to-image flow. Use MSS when capture frequency, region selection, or pixel-data handling matters, and test performance on the actual deployment machine. Use PyAutoGUI when screenshots are one part of desktop interaction. For a website URL rather than a desktop screen, use a website-capture service such as ScreenshotNeo instead of setting up a browser-driving workflow.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchFrequently Asked Questions
Does PyAutoGUI take a screenshot as a Pillow image?
Yes. Its screenshot function returns a Pillow image, which you can save directly or process with Pillow.
Can Python capture screenshots on Wayland?
It can in some environments, but the workable route depends on the compositor, session, and available backend. Validate the specific setup rather than assuming uniform Wayland support.
Which library should I use for a screenshot of a website URL?
Pillow, MSS, and PyAutoGUI capture a desktop display. For a webpage addressed by URL, a screenshot API such as ScreenshotNeo is the more relevant tool.
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.




