I want to convert clipboard image content into an image
I tried
from PIL import ImageGrab
im = ImageGrab.grabclipboard()
im.save(filename)
it says ImageGrab.grabclipboard() is macOS and Windows only
I want to convert clipboard image content into an image
I tried
from PIL import ImageGrab
im = ImageGrab.grabclipboard()
im.save(filename)
it says ImageGrab.grabclipboard() is macOS and Windows only
Currently I have to use xclip to solve this problem
it will try to save image from clipboard and if not it will return 1
import os
if os.system(f"xclip -selection clipboard -target image/png -out > {filename}") == 0:
print("save")
return 0
else:
return 1