mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Update src/PIL/ImageGrab.py
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
099d696dc7
commit
6d12581385
|
@ -136,10 +136,11 @@ def grabclipboard():
|
|||
if shutil.which("wl-paste"):
|
||||
args = ["wl-paste"]
|
||||
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
||||
mime_types = output.splitlines()
|
||||
for image_type in ["image/gif", "image/png"]:
|
||||
if image_type in mime_types:
|
||||
args.extend(["-t", image_type])
|
||||
clipboard_mimetypes = output.splitlines()
|
||||
Image.preinit()
|
||||
for mimetype in Image.MIME.values():
|
||||
if mimetype in clipboard_mimetypes:
|
||||
args.extend(["-t", mimetype])
|
||||
break
|
||||
elif shutil.which("xclip"):
|
||||
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user