What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use PyAutoGUI’s screenshot() function with a region tuple in (left, top, width, height) order. The first two numbers identify the upper-left screen coordinate; the last two define the rectangle’s size.

import pyautogui

left, top, width, height = 100, 150, 400, 300
image = pyautogui.screenshot(region=(left, top, width, height))
image.save('region.png')

The call returns a Pillow image object, so you can continue processing it in Python or save it immediately. The same operation can save directly by passing a filename as the first argument.

What the region tuple means

PyAutoGUI uses screen coordinates whose origin is the top-left corner. X increases toward the right and Y increases downward, as described in the mouse-control documentation. A region is not expressed as two corners. It is always:

Value Meaning Example
left Horizontal coordinate of the rectangle’s upper-left corner 100
top Vertical coordinate of the rectangle’s upper-left corner 150
width Number of pixels captured horizontally 400
height Number of pixels captured vertically 300

Thus, (100, 150, 400, 300) starts 100 pixels from the left edge and 150 pixels from the top, then captures a 400-by-300 rectangle. Do not substitute (left, top, right, bottom); that is a different convention and will produce the wrong area.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Drawing Tablet XPPen StarG640 Digital Graphic Tablet 6x4 Inch Art Tablet with Battery-Free Stylus Pen Tablet for Mac, Windows and Chromebook (Drawing/E-Learning/Remote-Working)
  • Battery-Free Pen: StarG640 drawing tablet is the perfect replacement for a traditional mouse! The XPPen advanced Battery-free PN01 stylus does not require charging, allowing for constant uninterrupted Draw and Play, making lines flow quicker and smoother, enhancing overall performance
  • Ideal for Online Education: XPPen G640 graphics tablet is designed for digital drawing, painting, sketching, E-signatures, online teaching, remote work, photo editing, it's compatible with Microsoft Office apps like Word, PowerPoint, OneNote, Zoom, Xsplit etc. Works perfect than a mouse, visually present your handwritten notes, signatures precisely
  • Compact and Portable: The G640 art tablet is only 2 mm thick, it's as slim as all primary level graphic tablets, allowing you to carry it with you on the go
  • Chromebook Supported: XPPen G640 digital drawing tablet is ready to work seamlessly with Chromebook devices now, so you can create information-rich content and collaborate with teachers and classmates on Google Jamboard’s whiteboard; Take notes quickly and conveniently with Google Keep, and effortlessly sketch diagrams with the Google Canvas
  • Multipurpose Use: Designed for playing OSU! Game, digital drawing, painting, sketch, sign documents digitally, this writing tablet also compatible with Microsoft Office programs like Word, PowerPoint, OneNote and more. Create mind-maps, draw diagrams or take notes as replacement for mouse

Install PyAutoGUI and its screenshot dependencies

Install PyAutoGUI with pip. The official installation guide shows platform-specific commands; on macOS and Linux it currently uses:

python3 -m pip install pyautogui

On Windows, follow the Windows command in that same guide rather than assuming that a particular Python launcher or environment is present. Screenshot support requires Pillow. Linux installations also require the components named by the documentation, including scrot and Tkinter. Those operating-system requirements can change, so use the instructions for your installed PyAutoGUI release and distribution.

Check that your interpreter and pip refer to the same environment. A reliable pattern is to create or activate your virtual environment first, then run the installation command through that environment’s Python executable.

Capture and save a rectangle

Two-step form: receive the image, then save it

This form is useful when you need to inspect, crop, annotate or otherwise process the returned image before writing it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import pyautogui

left, top, width, height = 100, 150, 400, 300
image = pyautogui.screenshot(region=(left, top, width, height))
image.save('region.png')

image is a Pillow/PIL image object. The filename extension selects the usual image format when Pillow saves it; use a filename such as region.jpg or region.webp when that format is available in your Pillow installation.

One-call form: save while capturing

Pass the output filename to screenshot() and keep the same region keyword:

Rank #2
Sale
HUION Inspiroy H640P 6x4 inch Drawing Tablet 8192 Pen Pressure
  • Customize Your Workflow: The 6 customizable press keys on Huion H640P drawing tablet for pc let you assign your most-used commands—like undo, zoom, brush switch, or save—so you can keep your hands on the tablet and your mind on the art. Whether you're a digital painter switching brushes, or a comic artist zooming in and out, these keys keep your workflow smooth and uninterrupted. Plus, the Huion driver lets you save different shortcut profiles for different apps, so you never have to reconfigure when switching software.
  • Professional Pen Performance: Huion H640P drawing pad for computer comes with the battery-free PW100 stylus that's always ready when inspiration strikes. With 8192 levels of pressure sensitivity, every light sketch, or bold stroke responds naturally to your hand—just like a real pen. The 5080 LPI resolution and 233 PPS report rate deliver lag-free, precise strokes, so you can draw confidently without second-guessing your cursor. The pen side buttons help you switch between pen and eraser instantly.
  • Compact and Portable: Huion H640P computer graphics tablet features a compact, ultra-portable design at just 0.3 inches thin and 0.61 lbs light, so it slides easily into your backpack—perfect for sketching in coffee shops, taking notes in class, or editing on the go between home and studio. The 6x4 inch active area offers enough room for natural pen movements while fitting comfortably on crowded desks, or lecture hall seats.
  • Stable Compatibility: Huion H640P graphic drawing tablet works seamlessly with Mac, Windows, Linux PCs, and Android smartphones/tablets (OS version 6.0 or later). Left-handed friendly, and you just need to flip the tablet and adjust the settings in the driver. Please note: H640P does NOT support iPhone/iPad.
  • Move Beyond the Mouse: Huion Inspiroy H640P is a pen tablet that replaces your mouse for more natural, precise control. Freehand draw, take notes, or even play OSU—everything you do with a mouse, you can do better with a pen. The precise tip makes it ideal for detailed photo editing, graphic design, or signing PDF. Meanwhile, the ergonomic pen grip helps you avoid the strain that comes from hours of using a mouse.
import pyautogui

pyautogui.screenshot(
    'region.png',
    region=(100, 150, 400, 300),
)

This still returns the image object, so you can assign the call to a variable if you need both an on-disk file and in-memory processing.

Make the rectangle explicit in your own code

Naming each component prevents accidental swapping of width and height and makes later changes readable:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import pyautogui

region_left = 20
region_top = 80
region_width = 640
region_height = 360
region = (region_left, region_top, region_width, region_height)

shot = pyautogui.screenshot(region=region)
shot.save('dashboard-region.png')

Keep the tuple as four integers. If a configuration file supplies strings, convert and validate them before calling PyAutoGUI so an invalid value fails at your validation boundary rather than during capture.

Choose and verify screen coordinates

Start from the visible screen, not a window’s logical bounds

The coordinates describe the display surface available to PyAutoGUI. They are not browser CSS coordinates and they are not the right and bottom edges of a window. Identify the pixel at the upper-left of the area you want, then measure its width and height in screen pixels.

A practical way to avoid mistakes is to begin with a small test rectangle, save it, and open the resulting file. If the image starts too far left or right, change only left; if it starts too high or low, change only top. Adjust width and height independently when the origin is correct.

Use a table when you have repeatable capture targets

For scripts that capture several fixed areas, store the four values together and give each output a descriptive name:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Drawing Tablet XPPen G430S OSU, Graphic Drawing Tablet with 8192 Levels Pressure Battery-Free Stylus, 4 x 3 inch Ultrathin, for OSU Game, Online Teaching Compatible with Window/Mac Black
  • Ultra thin tablet: Active Area 4 x 3 inches. Fully utilizing our 8192 levels of pen pressure sensitivity―Providing you with groundbreaking control and fluidity to expand your creative output. Please note: The 4 x 3 inches is very small, please confirm that it will meet your needs before you purchase it
  • OSU game: Designed for OSU! gameplay, drawing, painting, sketching, E-signatures etc. No need to install drivers for OSU! It's also designed for both right and left hand users
  • Accurate Pen Performance: StarG430S computer graphics tablet is the perfect replacement for a traditional mouse! The XPPen advanced Battery-free PN01 stylus does not require charging, allowing for constant uninterrupted Draw and Play, making lines flow quicker and smoother, enhancing overall performance
  • Compact and Portable: The G430S art tablet is only 2 mm thick, it’s as slim as all primary level graphic tablets,Ultra-thin and portable, allowing you hold it in one hand and carry it on the go. This graphic drawing tablet supports Mac. However, since the product interface is micro USB to USB-A, if your computer is a Mac and does not have a USB-A port, you will need to purchase an OTG transfer adapter to ensure compatibility with your Mac. So please confirm your computer port before you purchase it
  • PLEASE NOTE: The XPPen StarG 430 is compatible with the Windows system 11/10/8/7(32/64 bit), and the Mac OS X version 10.10 or later, but it is incompatible with iOS and iPad OS. If your computer is a Mac, you need to grant permission to the Mac preferences first. Please go to our official website, and according to the guide: XPPen>Support>FAQ, find out the Star G430 and click, then click the question according to your Mac system. There are detailed guidelines for installing the driver so your tablet will work correctly. It's possible incompatible with the customer's own EMR system or other signature system. Please feel free to contact us to confirm the compatibility before your purchase
import pyautogui

areas = {
    'toolbar': (0, 0, 1200, 90),
    'main_panel': (80, 120, 1040, 700),
}

for name, region in areas.items():
    pyautogui.screenshot(f'{name}.png', region=region)

This keeps the coordinate order visible at the point where each rectangle is defined and makes it easy to audit a capture set.

Capture a region repeatedly

Put the operation in a function when a job needs the same geometry more than once:

from pathlib import Path
import pyautogui


def save_region(path, left, top, width, height):
    image = pyautogui.screenshot(region=(left, top, width, height))
    image.save(Path(path))


save_region('first.png', 100, 150, 400, 300)
save_region('second.png', 100, 150, 400, 300)

The function deliberately accepts the four components separately. That makes a call self-documenting and avoids passing a five-item tuple or accidentally placing a filename inside the region value.

Timing and capture behavior

The PyAutoGUI screenshot reference gives an approximate example of roughly 100 milliseconds for a full 1,920×1,080 screen capture. That is a documentation estimate for that resolution, not a guaranteed latency or an independent benchmark; a smaller region, different display, operating system and machine load can change the result. See the screenshot reference for the documented behavior.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you are capturing in a loop, measure the complete operation on the machine that will run it and choose an interval that allows the target application to redraw. Saving every frame to a slow filesystem can take longer than the capture itself, so separate capture timing from file-output timing when diagnosing delays.

Troubleshoot common failures

ImportError or an error mentioning Pillow

Screenshot functions depend on Pillow. Install it in the same environment as PyAutoGUI, then rerun the script. If installation appears successful but the import still fails, compare python and pip paths and install through the interpreter that launches your script.

Rank #4
Sale
XPPen Deco 01 V3 10x6 Drawing Tablet, 16K Battery-Free Stylus, 8 Keys
  • Word-first 16K Pressure Levels: The upgraded stylus features 16,384 levels of pressure sensitivity and supports up to 60 degrees of tilt, delivering smoother lines and shading for a natural drawing experience. With no battery or charging needed, it operates like a real pen, making it easy for beginners to create effortlessly. This functionality helps novice artists develop their skills and explore their creativity without the intimidation of complex tools
  • Designed for Beginners: This drawing pad desinged with 8 customizable shortcuts for both right and left-hand users, express keys create a highly ergonomic and convenient work platform
  • Perfectly Adapted for Android: The XPPen Deco 01 V3 art tablet supports connections with Android devices running version 10.0 and above. It is recommended to download the XPPen Tools Android application, which adapts to your smartphone's screen aspect ratio, ensuring accurate mapping. It also supports mapping on Android screens with different aspect ratios in portrait mode
  • Large Drawing Space, Bigger Bold Inspiration: This expansive drawing pad has10 x 6.25-inch helps you break through the limit between shortcut keys and drawing area
  • Easy Connectivity for Beginners: The Deco 01 V3 offers USB-C to USB-C connectivity, plus adapters for USB C. This ensures easy connection to various devices, allowing beginner artists to set up quickly and focus on their creativity without compatibility concerns. Whether using a laptop, tablet, or desktop, the Deco 01 V3 provides a seamless experience, making it an ideal choice for those just starting their digital art journey

Linux reports a missing scrot or Tkinter component

Install the operating-system packages listed in the official installation instructions for your Linux distribution. These are separate from the Python package and are why a successful pip install alone may not be sufficient.

The file is the wrong part of the screen

Check the tuple order first: it must be (left, top, width, height). Then verify that X is measured from the left and Y from the top. A common error is supplying right and bottom coordinates as the third and fourth values; PyAutoGUI interprets those as dimensions instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The image is clipped or empty

Confirm that the rectangle is inside the display area and that width and height are positive integers. Test with a smaller rectangle near the top-left, where the coordinate origin is unambiguous, then expand it gradually. Also make sure the desktop or application has finished drawing before the call runs.

The capture works interactively but fails in automation

Run the script in the same logged-in desktop session used for the manual test. A process without access to an active graphical display cannot capture that display. Keep the output path absolute while debugging so a successful save is not mistaken for a missing file in an unexpected working directory.

The result looks scaled compared with what you expected

Compare the saved image’s pixel dimensions with the width and height you supplied. If they differ from the coordinate system you used to measure the screen, re-measure the rectangle in the same desktop session and test with a known-size area. Do not “fix” a coordinate-order problem by changing dimensions blindly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When PyAutoGUI is the wrong capture layer

PyAutoGUI captures pixels from the computer on which Python is running. It is appropriate for a visible desktop region, but it requires a desktop session and local dependencies. If your real input is a web URL and you need a repeatable server-side image, a website screenshot API avoids browser-window coordinates entirely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HUION Drawing Tablet H420X Graphics Tablet with 8192 Level Pen Pressure
  • New upgraded version: Battery-free Stylus with 8192 Levels Pressure does not require charging, The report rate of the H420X graphic tablet has increased to 300 PPS, making lines quicker and smoother, and feel like a real pen. The pen also has 2 customizable buttons on the side that allow you to switch between right-clicking and the eraser etc instantly
  • Graphic design tablet H420X is only 7mm in thickness and 167g in weight. A slim and compact design with a active area of 4.17x2.6 inches and dimension of 6.77x4.3 inches make it perfect for limited desktop space and easy to carry out when on a trip.
  • H420X huion drawing tablet is compatible with Windows 7 or later, Mac OS 10.12 or later, and Android 6.0 or later. Huion H420X drawing pad has good compatibility with most drawing software including Adobe Photoshop, Paint tool sai, Corel Painter, Illustrator, Sketchbook, Manga Studio, Clip Studio Paint, Fireworks, Comic Studio, SAI, Krista, Infinite Stratos, Pixologic ZBrush and other major graphics applications, and more. H420X is NOT compatible with iOS.
  • H420X computer graphics tablets also can be used for playing OSU games, signing documents, taking notes, and more. No need to install the driver. Just plug and play!
  • The note taking tablet is also easier to handwrite write, edit, and annotate with a stylus for online education, e-learning, remote working, or web conference. HUION H420X also is compatible with XSplit, Zoom, Microsoft Teams, Word, Excel, PowerPoint, OneNote, and more

Or skip the browser setup

ScreenshotNeo captures a website from its URL through one GET request. It is not a replacement for a local desktop-region capture; it is the simpler choice when the thing you need is a clean screenshot of a web page rather than pixels at a user’s monitor coordinates. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.

The service also provides an MCP server for AI agents, with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Every plan includes the same feature set: full-page screenshots with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, pre-capture clicks, selector or network-idle waits, request blocking, headers, cookies, user-agent and authorization settings, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification.

Use the API base shown in the documentation at https://screenshotneo.com/docs/. The following calls use the supplied target URL and write the returned bytes to a file.

cURL

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)
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}`);

ScreenshotNeo has a Free plan with 1,000 screenshots per month and no card required. Paid plans start at $5 for 3,000 shots; higher plans are Starter $5/3,000, Growth $15/15,000, Pro $39/60,000, Scale $99/250,000 and Business $249/1,000,000, with two months free on yearly billing. If that matches your URL-capture use case, sign up free and keep the local PyAutoGUI method for true screen-coordinate work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical checklist

  • Install PyAutoGUI and Pillow in the environment that runs the script.
  • On Linux, complete the additional scrot and Tkinter setup named by the official guide.
  • Express the rectangle as four integers: (left, top, width, height).
  • Measure from the screen’s top-left origin, with X to the right and Y downward.
  • Use screenshot(region=...) when you need the returned Pillow image.
  • Pass a filename to screenshot() when you want immediate file output.
  • Test a small rectangle, inspect its pixel dimensions, then automate repeated captures.
  • Use ScreenshotNeo instead when the source is a web URL rather than a local desktop region.

Frequently Asked Questions

Can I keep the screenshot in memory instead of writing a file?

Yes. Assign the result of pyautogui.screenshot(region=...) to a variable and pass that Pillow image to the rest of your Python pipeline; saving is optional.

How can I capture several fixed rectangles in one run?

Represent each target as a name and a four-value region tuple, then loop over the mapping and call screenshot() once for each output file.

Is a website screenshot API equivalent to a PyAutoGUI region?

No. PyAutoGUI reads pixels from a local display rectangle. An API such as ScreenshotNeo loads a web URL remotely, so it does not use your monitor’s left, top, width and height coordinates.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.