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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

ImageGrab.grab(bbox=...) expects four pixel coordinates in the order (left, top, right, bottom). It does not expect (x, y, width, height). Even a correctly ordered tuple can capture the wrong area when its values came from logical GUI units or DPI-scaled cursor coordinates rather than the pixel space used by the captured image.

The reliable fix is to check both the tuple’s meaning and its units. Then account for platform-specific scaling and monitor layout before adjusting coordinates.

What ImageGrab expects in bbox

Pillow’s ImageGrab.grab takes a screen snapshot. Its bbox argument is a four-value box, (left, upper, right, lower), expressed in pixel coordinates. The first pair identifies one corner; the second pair identifies the opposite corner. In particular, right and lower are absolute positions, not a width and height.

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

Suppose the intended rectangle begins at (120, 80), is 300 pixels wide and 200 pixels high. Passing (120, 80, 300, 200) asks for a box whose right edge is at x=300 and bottom edge at y=200. It does not ask for a 300-by-200 rectangle. Convert dimensions to endpoints:

#1 Best Overall
Sale
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
left, top, width, height = 120, 80, 300, 200
bbox = (left, top, left + width, top + height)
image = ImageGrab.grab(bbox=bbox)

For the example, the resulting box is (120, 80, 420, 280). A tuple can contain integers and still describe the wrong region if its values are in the wrong order or use the wrong coordinate units.

Check the box before capturing

Print the values at the call site and verify they are integer pixel positions in left/top/right/bottom order. The box should have positive width and height: right > left and bottom > top. An empty or reversed extent can result from treating width and height as endpoints.

print("bbox:", bbox)
left, top, right, bottom = bbox
assert right > left and bottom > top
image = ImageGrab.grab(bbox=bbox)
print("captured size:", image.size, "mode:", image.mode)

Pillow documents that pixels inside the bounding box are returned as RGBA on macOS and RGB otherwise. That mode difference is normal; it does not by itself indicate a bad crop.

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.
Rank #2
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - Black
  • The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
  • Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
  • G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
  • Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
  • The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere

Why coordinate variables can be numerically valid but wrong

Width and height were passed as endpoints

This is the most direct variable-related mistake. Many interfaces describe a rectangle as x, y, width and height, while Pillow’s box describes two corners. Convert explicitly at the boundary between those representations:

def xywh_to_bbox(x, y, width, height):
    return (int(x), int(y), int(x + width), int(y + height))

bbox = xywh_to_bbox(x, y, width, height)
snapshot = ImageGrab.grab(bbox=bbox)

This conversion only fixes tuple semantics. It does not convert between logical points and physical screenshot pixels.

The coordinate source uses logical units, not screenshot pixels

GUI toolkits, accessibility APIs, cursor APIs, and screen-selection overlays may report coordinates in a coordinate system that differs from the captured image. Display scaling can make logical coordinates and physical pixels differ. Feeding one system’s values directly to another can shift, shrink, enlarge, or displace the crop.

Rank #3
Sale
Logitech M185 Compact Ambidextrous Wireless Mouse with Rubber Grips - Blue
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

Compare the coordinates with ImageGrab.grab().size to understand the image dimensions you are working with. This is a diagnostic, not a universal conversion formula: a desktop image size alone does not establish the unit convention of every coordinate API or every monitor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
full = ImageGrab.grab()
print("full capture size:", full.size)
print("coordinates:", x, y, width, height)
print("candidate bbox:", xywh_to_bbox(x, y, width, height))

macOS Retina scaling

Pillow’s documentation says macOS Retina captures are 2× by default. If your variables are logical points while the target region is addressed in physical pixels, the values may need consistent scaling. Pillow issue reports also describe screencapture producing 144-DPI physical pixels while the caller used 72-DPI virtual coordinates, so the reported fix was to scale all four box values. That report is a useful illustration, not proof that every macOS coordinate source should always be multiplied by two.

Determine how the variables were obtained and what units they represent before changing them. A screen-capture selection interface can also provide coordinates that are not pixel coordinates; a report for issue #3293 describes correcting the capture by using the pixel coordinate system. Treat that as a warning to verify the source rather than assume all overlay coordinates behave alike.

Rank #4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
  • Computer mouse for easily navigating a computer interface; click, scroll, and more
  • USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
  • High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
  • 3 buttons offer effortless fingertip control
  • Plug-and-go ready for instant use

Windows DPI virtualization

A Pillow issue report describes win32api.GetCursorPos() returning values that were wrong under display scaling. The reported remedy was to make the process per-monitor DPI aware before obtaining cursor coordinates. If a cursor position is your input, check the process’s DPI-awareness setting before collecting it, not just before calling ImageGrab.grab. Otherwise the values may already have been reported in a virtualized coordinate space.

Secondary monitors and negative coordinates

On Windows, Pillow’s current documentation notes that the top-left position can be negative when all_screens=True. A monitor positioned left of or above the primary display naturally has negative desktop x or y coordinates. Do not clamp these values to zero merely because they are negative: doing so changes the target location.

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

For a target outside the primary monitor, use all_screens=True and preserve signed coordinates. Pillow’s implementation obtains a desktop image plus an origin offset and crops relative to that offset. A capture or calculation that assumes the primary display begins at the desktop’s universal origin can therefore misplace or omit a secondary display; older issue reports also describe black output in multi-monitor scenarios.

Best Value
Sale
Acer Wireless Mouse for Laptop, 2.4GHz Computer Mouse 3 Adjustable 1600 DPI
  • 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
  • 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
  • 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
  • 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
  • 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
from PIL import ImageGrab

# Use desktop coordinates, including negative values where applicable.
bbox = (left, top, right, bottom)
image = ImageGrab.grab(bbox=bbox, all_screens=True)

Use this option when the target lies outside the primary monitor. It is not a substitute for verifying the coordinate origin and units.

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

A practical debugging sequence

  1. Record the context. Note the Pillow version, operating system, monitor arrangement, display scale, and the source of the variables: cursor API, GUI toolkit, accessibility interface, or selection overlay.
  2. Print and label the values. Confirm the tuple is (left, top, right, bottom), not (x, y, width, height). Check that all four values are integers and that right exceeds left and bottom exceeds top.
  3. Convert dimensions if needed. For (x, y, width, height), pass (x, y, x + width, y + height).
  4. Check units against the capture. Compare the box with ImageGrab.grab().size, and establish whether the source values are physical pixels or logical coordinates. Do not apply a scale factor until that is known.
  5. Check platform-specific behavior. On Retina macOS, verify point-versus-pixel scaling. On Windows, check per-monitor DPI awareness if using cursor coordinates, and keep negative desktop coordinates for monitors left of or above the primary screen.
  6. Test the relevant capture scope. For a Windows target on another monitor, try all_screens=True. Pillow uses different platform paths: current source describes macOS region capture through screencapture -R and Windows capture followed by an offset-aware crop.

Common symptoms and fixes

Symptom Likely cause What to check
The crop is too small, too large, or starts at the wrong edge width and height were passed as absolute right and bottom endpoints Convert (x, y, width, height) to (x, y, x + width, y + height).
The box is valid but consistently scaled or offset Coordinate units differ from the screenshot’s pixel coordinates Identify whether the values came from logical units, a cursor API, a toolkit, or an overlay; verify platform scaling.
A macOS Retina region does not line up Logical points and physical pixels may be mixed Verify the coordinate source’s units and apply a consistent conversion only when supported by that source.
Windows cursor-based coordinates are wrong at non-default scaling Process DPI virtualization may affect reported positions Make the process per-monitor DPI aware before obtaining the cursor coordinates.
A secondary-monitor crop is black, missing, or misplaced Monitor origin or desktop extent may be handled as if the primary screen were the whole desktop On Windows, use all_screens=True when appropriate and preserve negative coordinates.
The returned image mode differs across machines Platform-specific output mode macOS returns the bounded pixels as RGBA; other platforms return RGB according to Pillow’s documentation. Handle mode explicitly if downstream code requires a particular one.

Choose a fix based on how the coordinates were collected

Coordinate source or setup First thing to verify Relevant adjustment
Rectangle supplied as x, y, width, height Tuple semantics Compute right and bottom from the origin plus dimensions.
macOS Retina display Logical points versus screenshot pixels Scale consistently only after identifying the units; do not assume every source uses the same scale.
Windows cursor position under display scaling Process DPI awareness before reading coordinates Use per-monitor DPI awareness as described in the reported issue.
Windows multi-monitor desktop Whether the target lies beyond the primary monitor and whether its origin is negative Use all_screens=True for the relevant target and retain signed coordinates.
Screen-selection overlay or GUI toolkit Whether its coordinates are physical pixels Establish the overlay’s coordinate system before passing values to Pillow.

Or skip the browser setup

ImageGrab is for capturing the computer’s screen. If what you need is a screenshot of a public webpage, you can instead make one request to ScreenshotNeo’s website screenshot API. It returns an image or PDF for a URL; it is not a replacement for capturing arbitrary desktop applications or for solving a local screen-coordinate problem.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo 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. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000.

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.

Sign up for ScreenshotNeo free to get 1,000 screenshots a month with no card.

FAQ

Does a negative bbox coordinate always mean the tuple is invalid?

No. On Windows with all_screens=True, a negative desktop position can represent a monitor placed left of or above the primary display.

Should I always multiply macOS coordinates by two?

No. First identify whether the specific coordinate source reports logical points or physical pixels; the correct conversion depends on that source.

Is RGB output on macOS an error?

Not necessarily. Pillow documents RGBA for the bounded pixels on macOS and RGB otherwise, so output mode varies by platform.

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

Quick Recap

SaleBestseller No. 1
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Product carbon footprint: 3.97 kg CO2e; Contoured shape: Gives you more comfort and control
$14.90
SaleBestseller No. 3
Bestseller No. 4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Computer mouse for easily navigating a computer interface; click, scroll, and more; 3 buttons offer effortless fingertip control
$9.70

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.