Skip to content

Instantly share code, notes, and snippets.

@keuv-grvl
Last active February 21, 2023 14:09
Show Gist options
  • Save keuv-grvl/82227107b95e861bbe063a6cbd111d4a to your computer and use it in GitHub Desktop.
Save keuv-grvl/82227107b95e861bbe063a6cbd111d4a to your computer and use it in GitHub Desktop.
Capture android screen from Python
%pip install pure-python-adb imageio
from ppadb.client import Client as AdbClient
# plug your android device with USB debugging
client = AdbClient(host="127.0.0.1", port=5037)
device = client.devices()[0]
screencap = device.screencap()
import imageio as iio
np_img = iio.imread(bytes(screencap))
np_img.shape # (2400, 1080, 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment