mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-13 09:42:20 +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"):
|
if shutil.which("wl-paste"):
|
||||||
args = ["wl-paste"]
|
args = ["wl-paste"]
|
||||||
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
||||||
mime_types = output.splitlines()
|
clipboard_mimetypes = output.splitlines()
|
||||||
for image_type in ["image/gif", "image/png"]:
|
Image.preinit()
|
||||||
if image_type in mime_types:
|
for mimetype in Image.MIME.values():
|
||||||
args.extend(["-t", image_type])
|
if mimetype in clipboard_mimetypes:
|
||||||
|
args.extend(["-t", mimetype])
|
||||||
break
|
break
|
||||||
elif shutil.which("xclip"):
|
elif shutil.which("xclip"):
|
||||||
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user