Skip to content
Michael Sanders edited this page Apr 30, 2018 · 1 revision



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('RGBA', (width, height), bytes(bmp))
Clone this wiki locally
You can’t perform that action at this time.