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

Use Pillow’s ImageGrab for a straightforward image, PyAutoGUI when a screenshot belongs to desktop automation, MSS when you need monitor selection or repeated pixel processing, and pyscreenshot only for a backend-specific workaround. All four can capture a full display or a region, but they differ in coordinate formats, operating-system requirements and the type of image data they return.

Quick comparison

Method Best fit Region argument Result
Pillow ImageGrab Direct screenshots saved or processed as Pillow images bbox=(left, top, right, bottom) Pillow image
PyAutoGUI GUI automation that also needs screenshots region=(left, top, width, height) Pillow image
MSS Monitor selection, frequent capture and pixel analysis Mapping with top, left, width, height, or a monitor MSS screenshot object
pyscreenshot Special environments where a selectable backend helps Backend-dependent wrapper Image data

There is no reliable, cross-platform speed ranking for these four approaches. The PyAutoGUI documentation includes a rough timing example for one display size, but it is not a controlled comparison with a stated publication year. (Pillow ImageGrab documentation; PyAutoGUI screenshot documentation; MSS usage documentation; pyscreenshot on PyPI)

1. Pillow ImageGrab: the simplest direct capture

ImageGrab.grab() returns a Pillow image. With no arguments it captures the screen; with bbox it captures a rectangle whose coordinates are left, top, right and bottom.

Capture the whole screen

from PIL import ImageGrab

image = ImageGrab.grab()
image.save("screenshot.png")

Capture a region

from PIL import ImageGrab

image = ImageGrab.grab(bbox=(100, 100, 800, 600))
image.save("region.png")

Platform details that affect the result

  • The documented pixel mode is RGBA on macOS and RGB on other platforms.
  • macOS Retina captures are 2x by default. Pass scale_down=True when you need 1x sizing.
  • On Windows, all_screens=True captures all displays. Pillow also documents single-window capture using a window handle.
  • On Linux, if the default X11 display cannot return a snapshot, Pillow may fall back to gnome-screenshot, grim or spectacle when those programs are installed.

2. PyAutoGUI: screenshots within desktop automation

PyAutoGUI is convenient when the same script must inspect the screen and control the mouse or keyboard. Its screenshot() function returns a Pillow image, and the screenshot feature requires Pillow plus the operating-system capture support documented for your platform.

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

Capture the full display

import pyautogui

image = pyautogui.screenshot()
image.save("screenshot.png")

Capture a rectangular region

import pyautogui

image = pyautogui.screenshot(region=(100, 100, 700, 500))
image.save("region.png")

You can also pass a filename to screenshot() to save directly. PyAutoGUI documents platform-specific prerequisites, including the macOS screencapture command and Linux scrot; install or enable the requirement for the operating system where the script runs. Its region tuple is (left, top, width, height), unlike Pillow’s right-and-bottom bounding box.

3. MSS: monitor-aware and pixel-oriented capture

MSS exposes the virtual desktop and individual monitors, returns an MSS screenshot object, and provides conversion paths for Pillow and NumPy workflows. It is a strong fit for repeated capture loops or computer-vision code that needs direct pixel access.

Capture the primary monitor and write a PNG

import mss

with mss.MSS() as capture:
    image = capture.grab(capture.primary_monitor)
    mss.tools.to_png(image.rgb, image.size, output="screenshot.png")

If you use the example exactly, import the tools module as well:

import mss
import mss.tools

with mss.MSS() as capture:
    image = capture.grab(capture.primary_monitor)
    mss.tools.to_png(image.rgb, image.size, output="screenshot.png")

Capture a custom region

import mss
import mss.tools

area = {"top": 100, "left": 100, "width": 700, "height": 500}
with mss.MSS() as capture:
    image = capture.grab(area)
    mss.tools.to_png(image.rgb, image.size, output="region.png")

Choose among multiple monitors

MSS exposes a monitor list. Index 0 represents the virtual screen spanning all displays; indexes starting at 1 represent individual monitors. Reuse one MSS instance in a repeated loop instead of creating a new instance for every frame.

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

For OpenCV, use the screenshot’s BGR channel order as required by that workflow. For many other image tools, RGB is the appropriate representation. See the MSS usage guide and MSS examples.

4. pyscreenshot: a backend wrapper for unusual environments

pyscreenshot can be useful when one of its configurable backends solves an environment-specific problem, such as a Wayland setup, optional subprocess isolation or a system-backend requirement.

Basic capture

import pyscreenshot

image = pyscreenshot.grab()
image.save("screenshot.png")

Because pyscreenshot wraps available system or library backends, success still depends on what is installed and available on the host. Its project describes the package as obsolete for most cases now that Pillow supports Windows, macOS and Linux, so start with Pillow unless a pyscreenshot backend addresses a concrete problem. Consult the PyPI page and the project README for backend details.

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

Which Python screenshot method should you choose?

Choose Pillow when you need an image file or Pillow processing

It has the smallest API surface: call grab(), optionally provide bbox, then save or manipulate the returned image. Check Retina scaling, multi-monitor behavior and Linux fallback requirements before distributing the script.

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.

Choose PyAutoGUI when capture is one step in GUI automation

Use it when the script also locates screen content or controls mouse and keyboard input. Remember that its region uses width and height, and that OS-specific screenshot support is required.

Choose MSS for monitor selection or repeated pixel work

Its monitor list, region mappings and conversion options suit screen sampling, computer vision and capture loops. Keep one MSS instance alive while looping.

Choose pyscreenshot only for a backend-specific need

It can bridge an environment where another backend works better, but it is not the default choice for ordinary Windows, macOS or Linux captures.

Common failure points

  • Wrong region dimensions: Pillow expects (left, top, right, bottom); PyAutoGUI expects (left, top, width, height); MSS uses a monitor or named dimensions.
  • Missing Linux capture utility: Pillow’s documented fallback tools and PyAutoGUI’s Linux prerequisites must be installed and accessible when the native display path is unavailable.
  • Unexpected macOS size: Retina screenshots can be 2x; use Pillow’s scale_down=True when 1x output is required.
  • Wrong color order: MSS pixel data may need RGB or BGR conversion depending on whether the next library is a general image tool or OpenCV.
  • Multi-monitor coordinates: test whether your target is the virtual desktop or an individual monitor before hard-coding coordinates.

Or skip the browser setup

If you need screenshots of web pages rather than the computer’s desktop, ScreenshotNeo makes one HTTP request and returns a PNG, JPEG, WebP or PDF. It accepts the consent banner like a visitor, then 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 are not billed, and response headers identify the page verdict and billing status.

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

Use the API documentation at https://screenshotneo.com/docs/ for parameters and options:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The Free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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.