【发布时间】:2019-02-26 04:28:10
【问题描述】:
是的,我可以从 shell 中获取 png 流
adb exec-out screencap -p
这样的python代码
start_time = time()
pipe = subprocess.Popen("adb exec-out screencap -p", stdout=subprocess.PIPE, shell=True)
img_bytes = pipe.stdout.read()
read_time = time()
img = cv2.imdecode(np.frombuffer(img_bytes, np.uint8), cv2.IMREAD_COLOR)
end_time = time()
print('stream size', len(img_bytes))
print('read cost', read_time - start_time)
print('decode cost', end_time - read_time)
print('screencap cost', end_time - start_time)
还是太慢了
size 2452217
read cost 2.630615234375
decode cost 0.0625
screencap cost 2.693115234375
我可以在输出前压缩屏幕截图吗?
【问题讨论】:
标签: python adb screenshot