GitHub Vita Lite - Wolff's Store
Code / README | Releases | Issues
WolffsRoom/YouTubeOnVita

capture_check.py

511 bytes ยท Original / download

import ctypes,io,base64
from ctypes import wintypes
from PIL import ImageGrab
u=ctypes.windll.user32
hwnd=u.GetForegroundWindow()
r=wintypes.RECT();u.GetWindowRect(hwnd,ctypes.byref(r))
name=ctypes.create_unicode_buffer(255);u.GetWindowTextW(hwnd,name,255)
print('FG',name.value,'RECT',r.left,r.top,r.right,r.bottom)
im=ImageGrab.grab(bbox=(r.left,r.top,r.right,r.bottom))
im.thumbnail((880,550))
o=io.BytesIO();im.save(o,'PNG',optimize=True)
print('B64START')
print(base64.b64encode(o.getvalue()).decode())