Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use screencapture arguments to crop on macOS #6152

Merged
merged 1 commit into from Mar 27, 2022

Conversation

radarhere
Copy link
Member

Resolves #6144

There are two ways of looking at this change.

  1. Speed improvement. Rather than grabbing the complete screen on macOS, and then cropping the result to the bbox requested by the user, this PR tells screencapture the co-ordinates that we are interested in. The image does need to be resized afterwards, to avoid returning a image twice the size of the requested bbox, but presumably that is still faster than loading an image the size of the screen and cropping it.
  2. Since screencapture without arguments returns an image at double resolution, cropping to the bbox can produce an unexpected offset. By passing the arguments to screencapture, Pillow can leave the problem of calculating which portion of the screen is desired to the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageGrab.grab(bbox=) fails on Mac with Retina screen, or on secondary monitor
2 participants