Skip to content

Do not resize macOS retina screenshots by default#9266

Open
radarhere wants to merge 8 commits intopython-pillow:mainfrom
radarhere:imagegrab_resize
Open

Do not resize macOS retina screenshots by default#9266
radarhere wants to merge 8 commits intopython-pillow:mainfrom
radarhere:imagegrab_resize

Conversation

@radarhere
Copy link
Copy Markdown
Member

Resolves #9253

On macOS retina screens, ImageGrab.grab() will produce 2x images when not using bbox, but 1x images when using bbox. The issue describes this as inconsistent.

Scaling bounding box images down was added in #6152 with Pillow 9.1.0, so that is relatively new. This PR stops that resizing by default. If the user wishes to resize, they must provide a keyword-only argument,ImageGrab.grab(scale_down=True)

@hugovk
Copy link
Copy Markdown
Member

hugovk commented Mar 29, 2026

Just a thought: rather than tacking on a bool scale_down=False, perhaps scale=2? Who knows if Apple will produce a 4x or something in the future...

@radarhere
Copy link
Copy Markdown
Member Author

In main, bbox screenshots are captured at 1x.
In the current form of this PR, images are captured at 2x by default, and then 1x if scale_down=True.

If we change that to scale=2 by default, and then Apple releases 4x, users could start specifying scale=4, but our default would still be 2 for these super retina screens. So the default for 4x screens would no longer be 'full resolution' (4x) or 'bbox size' (1x), but something in the middle (2x). I don't imagine anyone would want something in the middle?

The only way I think scale is helpful is if the default is scale=1. But that's the very problem the issue creator is trying to avoid, where ImageGrab.grab(bbox) is giving 1x images currently, while ImageGrab.grab() gives 2x.

Instead, I've pushed a commit to improve the screen scaling detection, so that if Apple releases 4x in the future, the default will start capturing 4x. scale_down=True will still provide 1x.

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.

Add scale option to ImageGrab.grab function

2 participants