프로그래밍언어/ADB & Python

adb 연결 및 스크린캡쳐 예제

부산딸랑이 2023. 1. 8. 19:29
#USB기기연결
from ppadb.client import Client as AdbClient
import time
import os
client = AdbClient(host="127.0.0.1", port=5037)
devices = client.devices()
device = devices[0]

 


import PIL.Image as Image
import io
res = device.screencap()#스크린 캡쳐
img = Image.open(io.BytesIO(res))#캡쳐한 바이트배열을 img변수에담음
img.show()#출력