mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06: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,14 +147,11 @@ def grabclipboard():
|
||||||
clipboard_mimetypes = output.splitlines()
|
clipboard_mimetypes = output.splitlines()
|
||||||
|
|
||||||
def find_mimetype():
|
def find_mimetype():
|
||||||
for mime in Image.MIME.values():
|
if "image/png" in clipboard_mimetypes:
|
||||||
if mime in clipboard_mimetypes:
|
return "image/png"
|
||||||
return mime
|
if clipboard_mimetypes:
|
||||||
|
return clipboard_mimetypes[0]
|
||||||
|
|
||||||
Image.preinit()
|
|
||||||
mimetype = find_mimetype()
|
|
||||||
if not mimetype:
|
|
||||||
Image.init()
|
|
||||||
mimetype = find_mimetype()
|
mimetype = find_mimetype()
|
||||||
if mimetype:
|
if mimetype:
|
||||||
args.extend(["-t", mimetype])
|
args.extend(["-t", mimetype])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user