winapi - Pasting image from clipboard to MS Word has wrong aspect ratio -
this question kind of follow this one . i'm using code in first answer region of desktop, , copying clipboard. might seem didn't research, did. problem first contact ctypes, winapi , jazz. ms paint, paint.net , libreoffice can read image perfectly, ms word changes aspect ratio; sets width , height 15cm. my question is: kind of data word expecting? code example great. this current code (same other answer): import ctypes ctypes import wintypes pil import imagegrab io import bytesio msvcrt = ctypes.cdll.msvcrt windll = ctypes.windll kernel32 = windll.kernel32 user32 = windll.user32 gdi32 = windll.gdi32 img = imagegrab.grab() output = bytesio() img.convert("rgb").save(output, "bmp") data = output.getvalue()[14:] output.close() cf_dib = 8 gmem_moveable = 0x0002 global_mem = kernel32.globalalloc(gmem_moveable, len(data)) global_data = kernel32.globallock(global_mem) msvcrt.memcpy(ctypes.c_char_p(global_data), data, len(data)) kernel32.globalunloc