forked from Skyexu/TopSup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetImgTool.py
More file actions
31 lines (23 loc) · 776 Bytes
/
Copy pathGetImgTool.py
File metadata and controls
31 lines (23 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
# @Author : Skye
# @Time : 2018/1/9 00:40
# @desc : adb 获取截屏,截取图片
from PIL import Image
import os
import matplotlib.pyplot as plt
def pull_screenshot():
os.system('adb shell screencap -p /sdcard/screenshot.png')
os.system('adb pull /sdcard/screenshot.png .')
pull_screenshot()
img = Image.open("./screenshot.png")
# 用 matplot 查看测试分辨率,切割问题和选项区域
#region = img.crop((75, 315, 1167, 789)) # iPhone 7P
question = img.crop((50, 350, 1000, 560)) # 坚果 pro1
choices = img.crop((75, 535, 990, 1130))
plt.subplot(221)
im = plt.imshow(img, animated=True)
plt.subplot(222)
im2 = plt.imshow(question, animated=True)
plt.subplot(212)
im3 = plt.imshow(choices, animated=True)
plt.show()