mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Use image/png mime type for ImageGrab (wl-paste) if possible, otherwise the first mime type taken
This commit is contained in:
parent
c656583b84
commit
fffcb558f6
|
@ -147,15 +147,12 @@ def grabclipboard():
|
|||
clipboard_mimetypes = output.splitlines()
|
||||
|
||||
def find_mimetype():
|
||||
for mime in Image.MIME.values():
|
||||
if mime in clipboard_mimetypes:
|
||||
return mime
|
||||
if "image/png" in clipboard_mimetypes:
|
||||
return "image/png"
|
||||
if clipboard_mimetypes:
|
||||
return clipboard_mimetypes[0]
|
||||
|
||||
Image.preinit()
|
||||
mimetype = find_mimetype()
|
||||
if not mimetype:
|
||||
Image.init()
|
||||
mimetype = find_mimetype()
|
||||
if mimetype:
|
||||
args.extend(["-t", mimetype])
|
||||
elif shutil.which("xclip"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user