Copy image to clipboard in Python3
from PIL import Image
from io import BytesIO
import win32clipboard
def send_msg_to_clip(type_data, msg):
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardData(type_data, msg)
win32clipboard.CloseClipboard()
def paste_img(file_img):
image = Image.open(file_img)
output = BytesIO()
image.convert('RGB').save(output, 'BMP')
data = output.getvalue()[14:]
output.close()
send_msg_to_clip(win32clipboard.CF_DIB, data)