What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The shortest working recipe is image = pyautogui.screenshot(). It returns a Pillow image object. Pass a filename to save the capture immediately, or pass region=(left, top, width, height) to capture only a rectangle of the screen.
Install PyAutoGUI and its screenshot dependency
Install PyAutoGUI in the Python environment that will run your script:
python -m pip install pyautogui pillow
PyAutoGUI’s screenshot implementation requires Pillow, the Python imaging library. The official installation notes describe additional platform packages. On Linux, those notes list scrot, python3-tk and python3-dev; the documentation presents an apt-based setup for Debian-like systems. Package names and desktop requirements can differ on another distribution, so check the current guidance for your operating system in the PyAutoGUI installation documentation.
PyAutoGUI’s overview covers Windows, macOS and Linux. A particular desktop compositor, screen-recording permission, display server, virtual machine or remote session can still change what a capture returns. Treat the platform notes as setup guidance rather than a guarantee for every current desktop configuration.
#1 Best Overall
Take a full-screen screenshot
Import the module and call screenshot():
import pyautogui
# Capture the current screen as a Pillow image.
image = pyautogui.screenshot()
# Do anything your Pillow workflow requires here.
print(type(image))
The returned value is a Pillow/PIL Image object, so you can inspect it, manipulate it or save it later with Pillow. This call captures the screen visible to the Python process; it does not navigate a web page or create a browser-specific document.
Save the screenshot to a file
Give screenshot() a filename when you want the capture written immediately. The function still returns the image:
import pyautogui
image = pyautogui.screenshot("my_screenshot.png")
print("Saved the image and received:", type(image))
Alternatively, keep the returned object and use Pillow’s save method when your program has decided on a path:
import pyautogui
image = pyautogui.screenshot()
image.save("my_screenshot.png")
Use a path your process can write to. A relative path is resolved from the script’s current working directory, which may not be the directory containing the Python file when a scheduler, IDE or service launches it.
Recommended Free Tools
Capture only a rectangular region
Pass a four-item tuple in this exact order: (left, top, width, height). The first two values identify the rectangle’s top-left origin; the last two are dimensions, not bottom-right coordinates.
Rank #2
import pyautogui
# Start at x=0, y=0 and capture 300 by 400 pixels.
region_image = pyautogui.screenshot(region=(0, 0, 300, 400))
region_image.save("top_left.png")
For a rectangle beginning at a different point, change the first two values:
import pyautogui
left = 200
top = 120
width = 800
height = 600
image = pyautogui.screenshot(region=(left, top, width, height))
image.save("panel.png")
| Goal | Call | Result |
|---|---|---|
| Whole visible screen | pyautogui.screenshot() |
Pillow image covering the screen capture area |
| Whole screen and immediate save | pyautogui.screenshot("my_screenshot.png") |
File is written and the image object is returned |
| Rectangle | pyautogui.screenshot(region=(left, top, width, height)) |
Pillow image for the requested origin and dimensions |
Turn the capture into a reusable Python function
A small helper keeps the capture policy in one place and lets callers choose a full screen or a region:
from pathlib import Path
from typing import Optional, Tuple
import pyautogui
Region = Tuple[int, int, int, int]
def take_screenshot(path: str, region: Optional[Region] = None):
"""Capture the screen and save it at path; return the Pillow image."""
output = Path(path)
if region is None:
image = pyautogui.screenshot()
else:
image = pyautogui.screenshot(region=region)
image.save(output)
return image
full = take_screenshot("captures/full.png")
partial = take_screenshot("captures/toolbar.png", (50, 50, 900, 160))
print(full.size, partial.size)
Create the destination directory before calling the helper if it does not already exist:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →from pathlib import Path
Path("captures").mkdir(parents=True, exist_ok=True)
The region argument remains a coordinate-and-size tuple. If you accidentally provide two corner points, the resulting dimensions will not represent the rectangle you intended.
Use the returned Pillow image in a workflow
Because the result is a Pillow/PIL image, a capture can remain in memory while your program performs image operations, compares it with another image or saves it under a generated name. Keeping the object also avoids taking a second screenshot when you need both immediate processing and a file.
import pyautogui
image = pyautogui.screenshot()
print("pixel dimensions:", image.size)
image.save("latest.png")
Keep sensitive screen content in mind. Screenshots can include passwords, personal messages, tokens and customer data. Choose an access-controlled output directory and avoid committing captures to a source repository.
Timing, performance and capture scope
The PyAutoGUI screenshot reference gives a conditional example of “roughly 100 milliseconds on a 1920 × 1080 screen” — PyAutoGUI documentation, publication year not stated (indexed crawl approximately five years ago). That is a documentation example, not a benchmark or a promise for your machine. Resolution, desktop environment, display count, virtualization and remote access can all affect elapsed time.
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 minuteWindows 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 reinstallIf you need many captures, measure on the machine and session that will run the job. Reuse your Python process, capture only the required region, and save asynchronously in your own code if disk latency becomes the bottleneck. These are workflow choices; PyAutoGUI’s documentation does not establish a universal throughput figure.
Troubleshoot common failures
ModuleNotFoundError: No module named 'pyautogui'
Install into the same interpreter that launches the script, then verify that interpreter:
python -m pip install pyautogui pillow
python -c "import pyautogui; print(pyautogui.__file__)"
In an IDE, select that interpreter as the project environment. Installing into a different system Python does not make the module available to a virtual environment.
The import works, but the screenshot call fails on Linux
Check the platform packages named in the installation guide: the documentation lists scrot, python3-tk and python3-dev for Linux. The guide’s package command targets an apt-based system; do not copy it unchanged to a distribution that uses another package manager. If you are in a container, SSH session or unusual desktop session, confirm that a usable graphical display and the required permissions are available.
The image is blank, black or not the expected desktop
Test from a normal local graphical session first. Screen-capture permissions, a compositor, a locked session, a virtual display and remote-desktop behavior can change the result. The official overview confirms the Windows, macOS and Linux scope, but it does not settle every contemporary compositor, multi-display or remote-session case. Compare a full-screen call with a small known region and check the operating system’s privacy and screen-recording settings.
The crop is in the wrong place
Recheck the tuple order: (left, top, width, height). The first coordinate is horizontal position, the second is vertical position, and the final two values are sizes. Do not pass (left, top, right, bottom).
The script is slower than expected
Measure a few calls with the same resolution and desktop session used in production. The roughly-100-millisecond figure applies to the documentation’s 1920 × 1080 example only. Reduce the region when a full screen is unnecessary and separate capture time from file-writing time in your measurement.
A practical checklist
- Install PyAutoGUI and Pillow in the active Python environment.
- Confirm the operating system’s screen-capture permissions and graphical session.
- Use
pyautogui.screenshot()for the full capture. - Use
region=(left, top, width, height)for a rectangle. - Pass a filename or call
image.save()when persistence is required. - Keep credentials and private screen content out of shared capture folders.
- Measure timing on the actual display environment instead of relying on a documentation estimate.
Or skip the browser setup
If your real goal is a screenshot of a public web page rather than the desktop session, ScreenshotNeo is a website screenshot API and MCP server. It is the first option to try when you want a clean page capture: it accepts cookie and consent banners before capture, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and bills only clean shots.
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 minuteOne GET request returns a PNG, JPEG, WebP or PDF. The response identifies page and billing status with X-Page-Verdict and X-Billed headers. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing. Every response reports which case occurred.
Best Value
For AI workflows, its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The API also supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus arbitrary viewports, retina scale, PDF paper and margin controls, custom CSS and JavaScript, clicks before capture, selector hiding, selector/delay/network-idle waits, request and resource blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, 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 to ease migration.
cURL
See the ScreenshotNeo documentation for the complete parameter reference.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
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)
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 data = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', data);
Plans and predictable billing
| Plan | Included shots per month | Price |
|---|---|---|
| Free | 1,000 | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Yearly billing gives two months free, and every feature is included on every plan. You can start with 1,000 screenshots a month at no charge and without entering a card by creating a ScreenshotNeo account.
FAQ
Does PyAutoGUI return a file path?
No. It returns a Pillow/PIL Image object. Supplying a filename writes the image and still returns that object.
Can I use a region without taking a full-screen image first?
Yes. Pass the four-value region tuple directly to pyautogui.screenshot(); the capture is limited to that rectangle.
Frequently Asked Questions
Does PyAutoGUI return a file path?
No. It returns a Pillow/PIL Image object. Supplying a filename writes the image and still returns that object.
Can I use a region without taking a full-screen image first?
Yes. Pass the four-value region tuple directly to pyautogui.screenshot(); the capture is limited to that rectangle.
Free tools Windows power users keep installed
One-click scans. No signup 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.




