The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Install PyAutoGUI with python3 -m pip install pyautogui, then call pyautogui.screenshot(). It returns a Pillow image; pass a filename to save immediately, or pass region=(left, top, width, height) to capture a rectangle.
import pyautogui
image = pyautogui.screenshot('screen.png')
print(image.size)
Install PyAutoGUI and its screenshot backends
Install the package into the same Python environment that will run your script:
python3 -m pip install pyautogui
PyAutoGUI documents support for Windows, macOS and Linux. Screenshot capture requires Pillow, which PyAutoGUI uses for the returned image. On Linux, install the scrot command as well:
sudo apt-get install scrot
If you use a virtual environment, activate it before both installation and execution. A quick verification script is:
#1 Best Overall
- Compatible with Nintendo Switch 2’s new GameChat mode
- Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
- The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
- C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
- The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.
import pyautogui
image = pyautogui.screenshot()
print(type(image).__name__, image.size)
The call should print a Pillow image type and its pixel dimensions. Keep the Linux scrot dependency next to your deployment instructions; a missing capture backend can make otherwise correct Python fail.
Capture the entire display
Save directly while taking the screenshot
Passing a filename causes PyAutoGUI to write the image and still return the image object:
import pyautogui
image = pyautogui.screenshot('screen.png')
print(f'Saved {image.size[0]}x{image.size[1]} pixels')
The filename extension in this example is PNG. Because the image is returned, you can inspect or process it in the same operation without taking a second screenshot.
Capture first, save later
Omit the filename when you need to decide where or how to save after capture:
Recommended Free Tools
import pyautogui
image = pyautogui.screenshot()
image.save('screen.png')
Use this form when a program chooses the destination dynamically, adds a timestamp, or needs to perform other work before writing the file. Both forms represent the same screenshot operation; the choice is about when you commit the file.
Capture only part of the screen
Use the region argument with a four-item tuple: (left, top, width, height). The first two values select the rectangle’s position; the last two define its dimensions.
import pyautogui
crop = pyautogui.screenshot(region=(0, 0, 300, 400))
crop.save('crop.png')
For example, (0, 0, 300, 400) captures a 300-by-400-pixel rectangle beginning at the supplied screen coordinates. You can also save the region in one call:
Rank #2
- Compatible with Nintendo Switch 2’s new GameChat mode
- Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
- Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
- Built-In Mic: The built-in microphone lets others hear you clearly during video calls
- Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
import pyautogui
crop = pyautogui.screenshot('panel.png', region=(120, 80, 640, 480))
| Method | Coverage | Typical result | When to choose it |
|---|---|---|---|
screenshot() |
Entire display | Larger image and file | Audits, complete desktop evidence, or context around an interaction |
screenshot(region=(left, top, width, height)) |
One rectangle | Smaller image and file | Repeated inspection of a known panel or control |
Region capture is also useful when a later image search only needs one area. The smaller search area can reduce unnecessary work.
A reusable Python screenshot script
This complete script supports a full display capture or an optional rectangle, and lets the caller choose the output path:
#!/usr/bin/env python3
import argparse
import pyautogui
def main():
parser = argparse.ArgumentParser(description='Capture a display screenshot')
parser.add_argument('output', help='PNG path to write')
parser.add_argument('--region', nargs=4, type=int, metavar=('LEFT', 'TOP', 'WIDTH', 'HEIGHT'))
args = parser.parse_args()
region = tuple(args.region) if args.region else None
image = pyautogui.screenshot(args.output, region=region)
print(f'Wrote {args.output}: {image.size[0]}x{image.size[1]}')
if __name__ == '__main__':
main()
Run a full-screen capture with:
python3 capture.py desktop.png
Run a 640-by-480 capture positioned at (120, 80) with:
python3 capture.py panel.png --region 120 80 640 480
Keeping the region as integers makes the command-line contract explicit and avoids accidentally passing a string tuple.
Use the returned Pillow image in a workflow
screenshot() returns an Image object even when a filename is supplied. That means one capture can feed validation, cropping, or another Pillow operation before the final save. If the required artifact is only a rectangle, capture it with region rather than capturing the full display and cropping afterward.
For repeated jobs, keep the capture loop small and write only the images you need. A practical pattern is:
import time
import pyautogui
for index in range(5):
image = pyautogui.screenshot(region=(0, 0, 800, 600))
image.save(f'frame-{index:02d}.png')
time.sleep(1)
The region in this example is illustrative; choose coordinates that match the display being captured.
Rank #3
- 1080P HD Webcam: This HD webcam delivers crisp 1080p video quality, ideal for PCs, desktops, and laptops. Perfect for video calls, online classes, meetings, live streaming, gaming, and everyday recording. It provides clear, sharp images and smooth video at up to 30 frames per second. This live streaming webcam works with platforms such as Zoom, Teams, FaceTime, Google Meet, and YouTube.
- USB Plug and Play Webcam: Designed for PCs, this webcam is easy to use. No drivers or software are required; simply connect the webcam to your computer and start using it immediately. Operation is smooth and convenient. XWEIRYN webcams are compatible with multiple operating systems, including Mac/Windows XP/7/8/10/11/PC/Laptops.
- Widely Compatible Webcam: This versatile webcam is compatible with most operating systems and major video platforms. As a reliable computer webcam, it supports video conferencing, remote learning, live streaming, and gaming, meeting your various needs for daily work and entertainment.
- Smooth and Stable Performance: This webcam uses a stable transmission chip to ensure smooth, lag-free video streaming, synchronized audio and video, and no dropped frames. Even after prolonged use, this durable webcam maintains stable performance. It performs excellently even in low-light environments. It automatically adjusts to adapt to low-light conditions, reducing noise and restoring vibrant colors, ensuring clear and sharp images even without additional studio lighting.
- Compact and Adjustable Design: This lightweight and portable webcam saves space and comes with an adjustable clip. Our USB webcam uses a reliable USB 2.0/3.0 connection and comes with an upgraded 1.5-meter (5-foot) braided cable. It is compatible with Desktop most monitors and Laptop. Its portable design makes it easy to place and carry, ideal for home, office, or travel use.
Timing and image-location performance
PyAutoGUI’s documentation reports that on a 1920 × 1080 screen, screenshot() takes roughly 100 milliseconds. That is guidance for that resolution, not a guarantee for every computer, display size, desktop compositor, or workload.
If your program repeatedly inspects a screen, capture only the needed region when possible. PyAutoGUI’s image-location functions can search a screenshot or the live screen, and the documentation says locate calls can take about one or two seconds. Supplying a region to a locate call can improve speed by limiting the search area.
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11import pyautogui
reference = 'button.png'
try:
box = pyautogui.locateOnScreen(reference, region=(0, 0, 800, 600))
print(box)
except pyautogui.ImageNotFoundException:
print('Reference image was not found in the region')
Current documented behavior raises ImageNotFoundException when no match is found. If your installed release documents older behavior, follow that release’s reference when choosing exception handling.
Common problems and fixes
ModuleNotFoundError: No module named 'pyautogui'
Install with the interpreter that runs the script, not a different system Python:
python3 -m pip install pyautogui
python3 capture.py screen.png
When using a virtual environment, activate it first and repeat both commands there.
Linux reports that a screenshot backend is unavailable
Install scrot and retry:
sudo apt-get install scrot
Pillow is required on every supported platform; reinstalling PyAutoGUI in the correct environment will normally restore that dependency.
The output is the wrong size or area
Check the tuple order. It must be (left, top, width, height), not (x1, y1, x2, y2). Print the returned image’s size and test with a small, known rectangle before wiring coordinates into automation.
Rank #4
- 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
- Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
- Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
- Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
- High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
locateOnScreen() raises an exception
In current documented behavior, no match raises ImageNotFoundException. Catch it when a missing match is an expected branch, and restrict the search with region when the target can occur only in one panel.
A repeated job feels slow
The documented 100-millisecond figure applies to a 1920-by-1080 example, and locate calls can take one or two seconds. Avoid taking an unnecessary full-display image, capture a smaller region, and avoid running image-location searches across the whole screen when a bounded area is sufficient.
The script works on one operating system but not another
PyAutoGUI documents Windows, macOS and Linux support, but Linux additionally needs the scrot command for screenshot functionality. Treat that package as a platform prerequisite in installation scripts and container or workstation setup.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →What this method does—and does not—capture
PyAutoGUI captures the display that the desktop environment exposes to it. The documented API here is full-display capture or rectangular region capture. The cited reference does not establish special handling for protected video, minimized windows, or an active window independently of the desktop compositor, so do not design a workflow that assumes those capabilities.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup with ScreenshotNeo
If your real input is a public web URL rather than a local desktop, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. Its capture flow accepts cookie or consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off.
Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and each response reports the result in X-Page-Verdict and X-Billed headers. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
See the ScreenshotNeo API documentation for authentication and the full parameter reference. This one-call cURL example captures Stripe:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in Python is:
import requests
r = requests.get(
'https://api.screenshotneo.com/v1/shot',
params={'access_key': 'YOUR_API_KEY', 'url': 'https://stripe.com'},
timeout=90,
)
r.raise_for_status()
open('shot.webp', 'wb').write(r.content)
And in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
Options for production captures
ScreenshotNeo lists 63 options, including:
- Full-page capture with lazy images loaded.
- Capture one element by CSS selector.
- Dark mode, 12 device presets, arbitrary viewports and retina scale.
- PDF paper size, margins, landscape mode and page ranges.
- HTML/CSS to image.
- Custom CSS and JavaScript.
- Click an element before capture.
- Hide selectors.
- Wait for a selector, a delay or network idle.
- Block ads, trackers, requests or resource types.
- Custom headers, cookies, user agent and
Authorization. - Timezone and geolocation.
- Transparent background and image resizing.
- Caching with a TTL you choose.
- Signed links for public
<img>tags. - Asynchronous jobs with signed webhooks.
- Bulk capture of up to 100 URLs per call.
- A usage API and an OpenAPI specification.
- Parameter names used by other screenshot APIs also work, easing migration.
Every feature is available on every plan. Current plans are:
Best Value
| Plan | Price | Included shots |
|---|---|---|
| Free | $0 | 1,000 per month, no card |
| Starter | $5 | 3,000 |
| Growth | $15 | 15,000 |
| Pro | $39 | 60,000 |
| Scale | $99 | 250,000 |
| Business | $249 | 1,000,000 |
Yearly billing gives two months free. If you want URL captures without installing a desktop browser stack, start with 1,000 free screenshots a month and no card.
FAQ
Can I use PyAutoGUI for a web page without opening a local browser?
PyAutoGUI’s documented workflow captures the display or a display region. For a URL-only workflow, use an HTTP screenshot service such as ScreenshotNeo instead.
What should I record when diagnosing a failed capture?
Record the operating system, Python interpreter used for installation, whether Pillow is available, and on Linux whether scrot is installed. Also print the requested region and the returned image dimensions.
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 errorsShould I treat the documented timing as a service-level guarantee?
No. The roughly 100-millisecond figure is documentation guidance for a 1920-by-1080 screen; measure your own workload when latency matters.
Frequently Asked Questions
Can I use PyAutoGUI for a web page without opening a local browser?
PyAutoGUI’s documented workflow captures the display or a display region. For a URL-only workflow, use an HTTP screenshot service such as ScreenshotNeo instead.
What should I record when diagnosing a failed capture?
Record the operating system, Python interpreter used for installation, whether Pillow is available, and on Linux whether scrot is installed. Also print the requested region and the returned image dimensions.
Should I treat the documented timing as a service-level guarantee?
No. The roughly 100-millisecond figure is documentation guidance for a 1920-by-1080 screen; measure your own workload when latency matters.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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.

