Merge pull request #7219 from abey79/grabclipboard-mac-png

This commit is contained in:
Hugo van Kemenade 2023-06-18 17:18:30 +03:00 committed by GitHub
commit 934a6c61a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,9 @@ Changelog (Pillow)
10.0.0 (unreleased) 10.0.0 (unreleased)
------------------- -------------------
- Changed grabclipboard() to use PNG instead of JPG compression on macOS #7219
[abey79]
- Added in_place argument to ImageOps.exif_transpose() #7092 - Added in_place argument to ImageOps.exif_transpose() #7092
[radarhere] [radarhere]

View File

@ -95,14 +95,14 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
def grabclipboard(): def grabclipboard():
if sys.platform == "darwin": if sys.platform == "darwin":
fh, filepath = tempfile.mkstemp(".jpg") fh, filepath = tempfile.mkstemp(".png")
os.close(fh) os.close(fh)
commands = [ commands = [
'set theFile to (open for access POSIX file "' 'set theFile to (open for access POSIX file "'
+ filepath + filepath
+ '" with write permission)', + '" with write permission)',
"try", "try",
" write (the clipboard as JPEG picture) to theFile", " write (the clipboard as «class PNGf») to theFile",
"end try", "end try",
"close access theFile", "close access theFile",
] ]