From f72dd8576ee77adec988dc1fe9777ee25f581a05 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Sat, 17 Jun 2023 12:55:58 +0200 Subject: [PATCH 1/3] Changed `grabclipboard()` to use PNG compression on macOS Before, a lossy JPG compression was used. --- src/PIL/ImageGrab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/ImageGrab.py b/src/PIL/ImageGrab.py index 39ecdf42096..4de5c69fb2f 100644 --- a/src/PIL/ImageGrab.py +++ b/src/PIL/ImageGrab.py @@ -102,7 +102,7 @@ def grabclipboard(): + filepath + '" with write permission)', "try", - " write (the clipboard as JPEG picture) to theFile", + " write (the clipboard as «class PNGf») to theFile", "end try", "close access theFile", ] From 3c4ccdcff54a7890176e57b5daf6757891678110 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Sat, 17 Jun 2023 12:59:42 +0200 Subject: [PATCH 2/3] Updated CHANGES.rst [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4af3fa51634..5da3986ba25 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ Changelog (Pillow) 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 [radarhere] From e52fa8fe386d5503bd3abb64773be208edcc58ca Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 17 Jun 2023 21:01:52 +1000 Subject: [PATCH 3/3] Use relevant extension for temporary file --- src/PIL/ImageGrab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/ImageGrab.py b/src/PIL/ImageGrab.py index 4de5c69fb2f..927033c6073 100644 --- a/src/PIL/ImageGrab.py +++ b/src/PIL/ImageGrab.py @@ -95,7 +95,7 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N def grabclipboard(): if sys.platform == "darwin": - fh, filepath = tempfile.mkstemp(".jpg") + fh, filepath = tempfile.mkstemp(".png") os.close(fh) commands = [ 'set theFile to (open for access POSIX file "'