Skip to content

Fix screenshot function to save user specified <imageFilename> on macOS#128

Open
addisonlee wants to merge 1 commit intoasweigart:masterfrom
addisonlee:fix-macos-screenshot-image-save
Open

Fix screenshot function to save user specified <imageFilename> on macOS#128
addisonlee wants to merge 1 commit intoasweigart:masterfrom
addisonlee:fix-macos-screenshot-image-save

Conversation

@addisonlee
Copy link
Copy Markdown

@addisonlee addisonlee commented Oct 9, 2024

Summary

On macOS, the screenshot function was only saving the user specified <imageFileName> for Pillow versions < 6.2.1.

It now saves user specified files for Pillow versions >= 6.2.1 as well.

Testing notes

I did not add any tests since test_pyscreeze.py already contained a failing test_screenshot test.

It contained 2 failing assertions. The 1st one (checking the saved file) now passes with this fix. The 2nd one (comparing size to resolution) still fails but it's a separate issue not related to this change.

…acOS

`screenshot` was only saving files for Pillow versions < 6.2.1.
It now saves files for Pillow versions >= 6.2.1 as well.

No new tests were added since there was already a (failing) test for this.
@addisonlee addisonlee changed the title Fix screenshot function to save user specified <imageFilename> on m… Fix screenshot function to save user specified <imageFilename> on macOS Oct 9, 2024
@renambrandao
Copy link
Copy Markdown

Hello, @asweigart,

I am commenting to confirm that this pull request effectively solves the silent screenshot failure on macOS.

I was experiencing the exact same issue on my system (macOS 15.6.1) where pyscreeze.screenshot() would run without error but produce no file.

I have manually applied this fix, and it resolved the problem perfectly. The change makes the macOS implementation consistent with the Windows and Linux versions by adding the im.save() command.

This seems to be a reliable and necessary fix.

@addisonlee, Thank you for your work on this project.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants