Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUse MSS’s current MSS context manager, then call grab() for a monitor or screen-coordinate region. For a quick PNG file, use shot(); for a crop or image processing, use grab() and save or convert the returned screenshot object.
Install MSS and capture a monitor
Install the library in the Python environment that will run your script:
python -m pip install mss
The current documented entry point is MSS. Use it as a context manager so MSS can manage its capture resources:
from mss import MSS
with MSS() as sct:
screenshot = sct.grab(sct.primary_monitor)
print(screenshot.size)
grab() returns an MSS ScreenShot object. The example captures the primary monitor; use the returned object when you need its pixels or want to convert or save it yourself.
Recommended Free Tools
#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.
Save a full-monitor screenshot as PNG
For a straightforward monitor capture written to a PNG file, use the documented shot() helper:
from mss import MSS
with MSS() as sct:
filename = sct.shot()
print(f"Saved screenshot to {filename}")
shot() returns the saved filename. To use the more general file-saving helper for monitor output, MSS also documents save(). If you need a specific crop or further image processing, use grab() instead.
Choose the right monitor
MSS exposes monitor geometry through sct.monitors. Index 0 describes the combined virtual screen spanning all displays; it is not the first physical monitor. Physical monitor entries start at index 1. The current API also provides sct.primary_monitor.
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.
from mss import MSS
with MSS() as sct:
for index, monitor in enumerate(sct.monitors):
print(index, monitor.left, monitor.top,
monitor.width, monitor.height)
# Capture the first physical monitor:
image = sct.grab(sct.monitors[1])
Use primary_monitor when you specifically want the primary display. Choose a numbered physical monitor when you need another display. To capture the whole multi-monitor desktop, select sct.monitors[0].
Free tools Windows power users keep installed
One-click scans. No signup required.
Capture only a region of the screen
A region uses screen coordinates: its left and top offsets, then its width and height. The documented Region form makes those values explicit:
import mss.tools
from mss import MSS
from mss.models import Region
region = Region(left=160, top=160, width=320, height=240)
with MSS() as sct:
image = sct.grab(region)
mss.tools.to_png(image.rgb, image.size, output="region.png")
The code writes a PNG named region.png. The example coordinates are relative to the virtual screen’s origin. If the target is on a monitor whose origin is not (0, 0), include that monitor’s left and top offsets when calculating the crop position.
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.
grab() also accepts a four-value PIL-style box in the order (left, top, right, bottom). Do not confuse that coordinate-bound form with Region, which takes width and height.
Calculate a crop relative to a chosen monitor
For a crop positioned relative to a specific monitor, add the crop’s local offsets to that monitor’s screen origin:
from mss import MSS
from mss.models import Region
with MSS() as sct:
monitor = sct.monitors[1]
region = Region(
left=monitor.left + 100,
top=monitor.top + 80,
width=400,
height=300,
)
image = sct.grab(region)
This keeps the crop anchored to the selected display even when that monitor sits to the left of, above, or otherwise offset from the virtual desktop origin.
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
Work with screenshot pixels or Pillow
If you need a Pillow image for processing, call to_pil() on the MSS screenshot object:
from mss import MSS
with MSS() as sct:
screenshot = sct.grab(sct.primary_monitor)
pil_image = screenshot.to_pil()
pil_image.save("screen.png")
For lower-level work, the screenshot object exposes pixel data, including its RGB bytes and dimensions. MSS documents direct screenshot-buffer integration with compatible libraries such as NumPy and OpenCV; using the buffer protocol can avoid some copying. That matters when the next operation is analysis rather than simply writing a PNG.
Platform and API considerations
Current API versus older examples
Prefer from mss import MSS and the MSS() context manager shown above. The older mss.mss() entry point remains available for compatibility but is deprecated. Current examples use monitor objects with attributes such as left, top, width, and height; older code may use a compatibility behavior that treats monitor data differently.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →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.
Linux display environments
On Linux, MSS documents xshmgetimage as its default backend and says it falls back to xgetimage when MIT-SHM is unavailable, such as in some remote SSH display situations. The documentation also describes xgetimage as a compatibility option and xlib as a legacy backend. This does not establish that every headless or Wayland environment will work without additional display configuration; check MSS requirements against the display server and session where the script will run.
Troubleshooting
- The wrong screen or too much content appears: Check whether you selected
monitors[0], which spans the entire virtual desktop. Use index1or higher for an individual physical monitor, orprimary_monitorfor the primary display. - A crop lands in the wrong place: Use the chosen monitor’s
leftandtopoffsets in the crop coordinates. Multi-monitor layouts can have negative or nonzero origins. - The saved file is not the intended crop: Confirm that a
Regionusesleft,top,width, andheight. A PIL-style box instead usesleft,top,right, andbottom. - Capture fails in a remote or Linux session: Verify that the Python process has access to a live display and that the session’s display server is supported and configured. Backend fallback behavior does not guarantee operation in every headless or Wayland setup.
- An older tutorial’s import or monitor access differs: Follow the current
MSSclass and monitor-attribute examples. Treatmss.mss()as deprecated compatibility syntax rather than the preferred interface.
Alternative: Pillow ImageGrab
Pillow’s ImageGrab.grab() is a reasonable alternative when you want a Pillow image directly and do not need MSS’s monitor-enumeration workflow. Its official documentation describes bbox support, RGB output on most platforms and RGBA on macOS, plus Retina scaling options on macOS. On Linux, it may use screenshot-tool fallbacks when the default X11 display does not return an image. Choose based on the image representation you need, multi-monitor requirements, and the actual OS and display server; neither interface is established as universally better by these documented behaviors.
Or skip the browser setup
MSS captures an existing desktop display. If instead you need a screenshot of a website, ScreenshotNeo offers a one-call website screenshot API. For example, this cURL request saves a PNG for Stripe:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.png
See the ScreenshotNeo API documentation for request options. It removes cookie banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are not billed; and its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Sign up free for ScreenshotNeo to get 1,000 screenshots a month with no card.
Frequently Asked Questions
Does MSS save screenshots as JPEG or WebP with `shot()`?
The documented `shot()` workflow in this guide is for PNG output. For another format, use an image-processing library to convert the captured image.
Can MSS capture a screenshot without saving it to disk?
Yes. Use `grab()` and keep the returned `ScreenShot` object in memory; save it only if your workflow needs a file.
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.

