You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Mac, PIL.ImageGrab.grabclipboard() is lossy because it uses JPG:
commands= [
'set theFile to (open for access POSIX file "'+filepath+'" with write permission)',
"try",
" write (the clipboard as JPEG picture) to theFile",
"end try",
"close access theFile",
]
This results in lossy acquisition, which can be highly undesirable.
One such cases is when dealing with screenshots. The noise induced by the JPG conversion on otherwise relatively flat image content eventually leads to much bigger PNG output (if such format is desired in the end).
This can be easily fixed with the following change:
commands= [
'set theFile to (open for access POSIX file "'+filepath+'" with write permission)',
"try",
" write (the clipboard as «class PNGf») to theFile",
"end try",
"close access theFile",
]
Happy to submit a PR if there is willingness to apply this change.
What are your OS, Python and Pillow versions?
OS: macOS Ventura
Python: 3.11
Pillow: 9.5
The text was updated successfully, but these errors were encountered:
Issue
On Mac,
PIL.ImageGrab.grabclipboard()
is lossy because it uses JPG:This results in lossy acquisition, which can be highly undesirable.
One such cases is when dealing with screenshots. The noise induced by the JPG conversion on otherwise relatively flat image content eventually leads to much bigger PNG output (if such format is desired in the end).
This can be easily fixed with the following change:
Happy to submit a PR if there is willingness to apply this change.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: