For a straightforward still image, use Pillow’s ImageGrab.grab(): it returns a Pillow image you can crop, inspect, or save. Choose MSS when you need to select a monitor or region and access pixel data directly; choose PyAutoGUI when screenshots are part of mouse, keyboard, or visual automation. The right choice also depends on the operating system, display server, permissions, and whether you need a screen, a window, or a region.
Choose an API for the capture you need
These libraries are not interchangeable in every environment. Decide what source you need, what you will do with the resulting pixels, and which display system runs the code.
| Need | Start with | Why | Check first |
|---|---|---|---|
| A full-screen or rectangular still image to process with Pillow | Pillow ImageGrab.grab() |
It returns a PIL image directly; omitting the bounding box captures the screen. | Image mode, coordinate scale, platform permissions, and Linux backend behavior. |
| Monitor selection, region capture, or pixel-buffer access | MSS | It exposes monitor metadata, region capture, and raw pixel data, with conversion to Pillow available. | Backend and display environment on the target machine. |
| Screenshots as part of desktop automation | PyAutoGUI | Its screenshot function fits into a workflow that also automates mouse and keyboard input. | Linux dependencies and the installed PyAutoGUI/PyScreeze versions. |
| Native macOS display, app, or window capture | Apple ScreenCaptureKit | Apple documents native still capture and streaming for displays, apps, and windows. | Permission and a Python bridge or binding; the framework documentation is not a Python setup guide. |
| Native Windows display or app-window capture | Windows.Graphics.Capture | Microsoft documents frame capture and a picker for selecting a source. | The cited Microsoft example is C#; it does not establish a Python binding. |
| Wayland desktop capture | A portal-backed capture path | The Qt for Python documented route uses the XDG Desktop Portal ScreenCast service and PipeWire. | Compositor and portal support; the operating system presents a source-selection wizard. |
For most Python scripts that need a still image, start with Pillow. Use MSS for explicit monitor or pixel-buffer work, and PyAutoGUI if capture belongs to a larger automation task. A library described as cross-platform does not guarantee identical behavior across operating systems or display servers.
Capture and save an image with Pillow
Install Pillow in the Python environment that will run the script:
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 reinstallCrashes, 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 minute#1 Best Overall
- 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
- 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
- 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
- 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
- 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
python -m pip install Pillow
Capture the full screen, or pass a bounding box in left, top, right, bottom order to capture a rectangle:
from PIL import ImageGrab
# Capture the screen.
image = ImageGrab.grab()
image.save("screenshot.png")
# Capture a rectangle: left, top, right, bottom.
region = ImageGrab.grab(bbox=(10, 20, 410, 320))
region.save("region.png")
The coordinates describe the rectangle’s edges, not its width and height. In the example, the region is 400 pixels wide and 300 high if coordinates map one-to-one to output pixels. Measure or inspect the target display before hard-coding a box: scaling and coordinate conventions can differ, particularly on high-density displays.
ImageGrab.grab() returns a Pillow image object. Pillow documents its mode as RGBA on macOS and RGB on other platforms; code that assumes one mode should check image.mode or convert explicitly. On Retina displays, capture can be at twice the apparent screen dimensions. Pillow’s scale_down=True option requests a 1x-sized result. See the Pillow ImageGrab documentation for platform-specific behavior and parameters.
Capture a particular window with Pillow
Recent Pillow documentation supports a window parameter: it accepts an HWND on Windows or a CGWindowID on macOS. This is version-dependent functionality, not a general cross-platform window selector. Pillow lists Windows support as added in version 11.2.1 and macOS support in version 12.1.0. Confirm the installed Pillow version and obtain the appropriate native window identifier before relying on it. A bounding box is a screen rectangle, not a reliable substitute for selecting a window whose position or size can change.
Recommended Free Tools
Select a monitor or inspect pixels with MSS
MSS is a good fit when your code needs monitor information, a defined capture region, or access to pixel bytes rather than only an image abstraction. Install it with:
Rank #2
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
python -m pip install mss
The current usage documentation recommends importing MSS; the older mss.mss() spelling is deprecated. This example captures the primary monitor, reads its BGRA pixel data, and converts the result to a Pillow image for saving:
from mss import MSS
with MSS() as sct:
shot = sct.grab(sct.primary_monitor)
pixels = shot.bgra
image = shot.to_pil()
image.save("primary-monitor.png")
pixels is a byte buffer in BGRA order. If you process it directly, account for the channel order and the captured width and height. MSS also accepts monitor objects and region specifications; inspect the monitor metadata provided by the installed version rather than assuming that monitor numbering or coordinates are identical on every system. Consult the MSS usage documentation for the current API.
Use PyAutoGUI when capture is part of automation
PyAutoGUI returns a Pillow image from its screenshot function, so it can save directly or feed into image-processing code:
import pyautogui
image = pyautogui.screenshot()
image.save("screenshot.png")
The screenshot documentation also describes saving by passing a filename to the screenshot function. PyAutoGUI is most useful when the same program needs its automation features, such as coordinating screenshots with mouse or keyboard actions; do not choose it on an assumption that it is the fastest capture route. Its screenshot documentation lists Pillow as a requirement and scrot for Linux screenshot functionality. That page is older, so check the current installed PyAutoGUI and PyScreeze behavior and platform package requirements before deploying. See PyAutoGUI’s screenshot documentation.
Account for operating-system permissions and display servers
macOS
Screen capture may require user permission. Apple’s ScreenCaptureKit documentation instructs developers to request permission and include NSScreenCaptureUsageDescription in the app’s Info configuration. A Python script can run under different identities depending on how it is launched or packaged, so test permission prompts and capture using the actual runtime used in deployment. ScreenCaptureKit is Apple’s native framework for display, app, and window capture; its documentation does not itself provide Python binding or bridge instructions. See Apple’s ScreenCaptureKit documentation.
Rank #3
- 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
- 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
- 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
- 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
- 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
Windows
Microsoft’s Windows.Graphics.Capture documentation describes capturing frames from a display or application window and using a picker to select the source. The linked example is in C#, not Python. Treat it as documentation for the native Windows route, not proof that a particular Python package or interop setup is available. See Microsoft’s screen-capture documentation.
Linux: distinguish X11 from Wayland
Linux capture behavior depends on the display server and desktop environment. Pillow documents X11 capture and certain fallbacks to gnome-screenshot, grim, or spectacle when the default X11 display does not produce a snapshot. Those fallbacks are not a general guarantee of Wayland compatibility. MSS documents Linux backends tied to the display configuration.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →For Qt for Python’s documented Wayland capture route, an XDG Desktop Portal ScreenCast service and PipeWire are required, and the operating system opens a selection wizard. Whether it works depends on the compositor and portal implementation. See Qt for Python’s QScreenCapture documentation. Do not assume that a method working under X11 will work under Wayland.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose image output, resolution, and capture frequency deliberately
Verify dimensions and color mode
After capture, inspect image.size and image.mode. This catches unexpected Retina scaling, region dimensions, and platform-specific channel modes before later image operations fail or produce an incorrectly sized result. If downstream code requires a specific mode, convert it explicitly—for example, image.convert("RGB")—rather than relying on the platform’s default.
Match the capture method to the data path
If the next step is saving, cropping, or applying Pillow transforms, a Pillow image is convenient. If the next step consumes raw pixels, MSS exposes pixel data and can avoid an unnecessary conversion in workflows that use its buffer directly. If automation is the main job, PyAutoGUI keeps screenshot calls alongside automation calls. The best choice depends on the actual output and platform, not a general speed ranking.
Rank #4
- AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
- Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
- Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
- Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
- Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
Benchmark the deployed workload
Capture cost depends on resolution, backend, operating system, and frequency. Benchmark on the machine and display setup that will run the application, especially for repeated or high-resolution captures. MSS documentation describes one Linux backend as roughly three times faster than another in that specific context; that figure is not a universal benchmark and does not compare MSS with Pillow or PyAutoGUI.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshoot common capture failures
- The image is blank or capture raises a permission error on macOS: check the screen-recording permission for the actual Python app or packaged runtime, and confirm that the app configuration includes
NSScreenCaptureUsageDescriptionwhen using the native framework. - The image size or region is wrong: inspect the output dimensions, display scaling, and bounding-box coordinates. On Retina, Pillow may return 2x pixels; use its documented
scale_down=Trueoption when a 1x result is appropriate. - Window capture fails or the argument is rejected: check the Pillow version and platform. The documented
windowparameter support is recent and accepts native window identifiers, not a window title. - Linux capture returns no image: identify whether the session is X11 or Wayland, then check the library’s backend and required system tools. Pillow’s documented command-line fallbacks do not make arbitrary Wayland capture work.
- Wayland capture is unavailable: verify that the desktop provides the XDG Desktop Portal ScreenCast service and PipeWire, and that its portal/compositor supports the flow. A user selection wizard is part of the Qt for Python route.
- PyAutoGUI capture fails on Linux: verify Pillow and the screenshot dependencies applicable to the installed PyAutoGUI/PyScreeze versions; the screenshot docs name
scrot, but their page is older. - MSS captures the wrong display: inspect the monitor metadata returned in the target environment and choose the intended monitor object or region explicitly rather than assuming numbering.
- Repeated captures are slower than expected: measure the actual resolution, backend, and capture interval on the deployment setup. Do not infer performance from another operating system or a library’s general reputation.
Or skip the browser setup
If the target is a public website rather than your computer’s desktop, a website screenshot API avoids installing and operating a browser capture stack. ScreenshotNeo is a website screenshot API and MCP server by Yorker Media. It accepts a URL and returns an image or PDF. For a one-request WebP capture, replace the sample URL and use your API key; see the ScreenshotNeo API documentation for request 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 removes cookie banners, newsletter popups, and chat widgets before capture, and each step can be turned off. Bot checks, blank pages, and failed loads are not billed; responses include page-verdict and billing headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.
Frequently Asked Questions
Can Pillow capture a specific window instead of the whole screen?
Recent Pillow versions document a platform-specific window parameter that accepts a native window identifier; it is not a cross-platform title-based selector.
Does a Python screen capture library work on Wayland just because it supports Linux?
No. Confirm that the capture path uses the desktop portal and PipeWire where required, and that the compositor supports it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Which option is best for raw pixels rather than a saved image?
MSS is the clearest starting point because its screenshot object exposes pixel data as well as conversion to a Pillow image.
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.

