Skip to content
Michael Sanders edited this page Mar 22, 2023 · 3 revisions

AutoPy

See also: the autopilot-rs FAQ.

FAQ

How do I get access to the raw buffer in an AutoPy bitmap?

autopy.bitmap.Bitmap includes an implementation of the bytes function for access to the RGBA buffer. E.g., to convert a bitmap to a PIL image you can use the following:

import autopy
import PIL.Image

bmp = autopy.bitmap.capture_screen()
width, height = int(round(bmp.width * bmp.scale)), int(round(bmp.height * bmp.scale))
img = PIL.Image.frombytes('RGB', (width, height), bytes(bmp))
Clone this wiki locally