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 →Use MSS’s current MSS class to capture a monitor or screen region. For a PNG file, the shortest path is sct.shot(); for a crop or image processing, use sct.grab() and save or convert the returned screenshot object.
Install MSS and capture a monitor
Install the library in the Python environment where your script will run:
python -m pip install mss
The current documented entry point is MSS, used as a context manager. This example captures the primary monitor and writes a PNG:
from mss import MSS
with MSS() as sct:
filename = sct.shot()
print(f"Saved screenshot to {filename}")
shot() is a convenient file-output helper. To select the monitor explicitly, or to use the pixels in Python, call grab():
Recommended Free Tools
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
from mss import MSS
with MSS() as sct:
screenshot = sct.grab(sct.primary_monitor)
print(screenshot.size)
grab() returns an MSS ScreenShot object rather than a filename. For simple monitor output, MSS also documents save(); use grab() when you need control over the capture rectangle or the image data.
Choose a monitor correctly
MSS exposes monitor geometry through sct.monitors. Index 0 is the combined virtual screen spanning all monitors, not the first physical display. Individual monitor entries start at index 1.
Rank #2
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
- 4GB DDR4 System Memory; 128GB Solid State Drive
- 11.6" HD (1366 x 768) Multi-Touch Display
- Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
- Windows 11 Pro
from mss import MSS
with MSS() as sct:
for index, monitor in enumerate(sct.monitors):
print(index, monitor)
first_physical_monitor = sct.grab(sct.monitors[1])
Use sct.primary_monitor when you specifically want the primary display. Use an entry from sct.monitors when the user should choose a physical monitor or the entire virtual desktop. Because monitors may have negative or nonzero origins in a multi-display layout, rely on each monitor’s left, top, width, and height values instead of assuming every display begins at (0, 0).
Capture and save a screen region
A region is described with its screen-coordinate origin and dimensions. The example below grabs a 320-by-240 rectangle and writes its RGB data as a PNG:
Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
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 coordinates above are relative to the virtual screen coordinate system. To crop relative to another monitor, add the crop’s offset to that monitor’s own 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)
MSS also accepts a PIL-style bounding box in the form (left, top, right, bottom) for grab(). In that form, right and bottom are the far edges of the rectangle; with a Region, specify width and height instead.
Rank #4
- EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
- 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
- RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
- ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
- LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
Save bytes or prepare the screenshot for image processing
If you need a PNG byte string rather than a file, omit the output filename from to_png():
import mss.tools
from mss import MSS
with MSS() as sct:
image = sct.grab(sct.primary_monitor)
png_bytes = mss.tools.to_png(image.rgb, image.size)
print(len(png_bytes))
For Pillow operations, convert the MSS screenshot object with to_pil():
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteBest Value
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
from mss import MSS
with MSS() as sct:
image = sct.grab(sct.primary_monitor)
pil_image = image.to_pil()
pil_image.save("screen.png")
For computer vision or pixel analysis, the screenshot object exposes pixel data and a buffer interface. Compatible libraries such as NumPy and OpenCV can work with screenshot buffers in ways that reduce copying; whether that is useful depends on the library and processing pipeline. If the sole goal is a PNG on disk, the direct file-saving helpers are simpler.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose MSS or Pillow based on the job
MSS is a natural fit when you need to enumerate monitors, select a monitor or coordinate-based region, or consume its screenshot object and buffer. Pillow’s ImageGrab.grab() returns a Pillow image and accepts a bbox, which may suit a workflow that already uses Pillow. The documented platform behavior differs: Pillow reports RGB output on most platforms and RGBA on macOS, supports Retina scaling options on macOS, and documents Linux screenshot-tool fallbacks when the default X11 display does not return an image. Neither interface is established as universally better; choose according to your display environment, multi-monitor needs, and desired image representation.
Display-server and environment considerations
Capturing a desktop requires an accessible display. On Linux, the MSS usage documentation describes xshmgetimage as the default backend, with a fallback to xgetimage when MIT-SHM is unavailable, such as on some remote SSH displays. It also describes xgetimage as a compatibility option and xlib as a legacy backend. Those backend details do not establish that every headless, remote, or Wayland environment will work without additional setup; verify the requirements for the actual display session and operating system.
Troubleshooting common capture problems
- The capture is the wrong display: check the printed
sct.monitorslist. Entry0covers the virtual desktop; choose an entry from index1onward for an individual monitor, or useprimary_monitor. - A crop is shifted or empty: inspect the selected monitor’s
leftandtopvalues and include them when calculating a region on a monitor whose origin is not zero. Confirm that width and height stay within the intended screen area. - The script fails to access a display: confirm that the process runs in a session with an available desktop display. For Linux remote or headless setups, check the display server and backend requirements rather than assuming a desktop screenshot is available.
- Older examples fail or produce deprecation warnings: prefer
from mss import MSSandwith MSS() as sct. The oldermss.mss()spelling remains available for compatibility but is deprecated in the current usage guide. - You expected a Pillow image:
grab()returns an MSS screenshot object. Callto_pil()to create a Pillow image, or use Pillow’s ownImageGrab.grab()if a Pillow-first interface is preferable.
Or skip the browser setup
MSS captures the computer’s existing display. If your goal is a website screenshot rather than a desktop screenshot, ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return an image or PDF; cookie banners, newsletter popups, and chat widgets are removed before the shot, and bot checks, blank pages, failed loads, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
For the full parameters and response details, see the ScreenshotNeo API documentation. Example using cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
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.




