利用ADB和PIL图片处理的Python抢红包工具
2022/2/1 11:57:46
本文主要是介绍利用ADB和PIL图片处理的Python抢红包工具,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
上代码
from PIL import Image import os def getPngPix(x,y): pngPath = r"D:\adb\screen.png" pixelX = x pixelY = y img_src = Image.open(pngPath) img_src = img_src.convert('RGB') str_strlist = img_src.load() data = str_strlist[pixelX, pixelY] img_src.close() return data while True: os.system(r"D:\adb\adb.exe shell screencap /sdcard/screen.png") os.system(r"D:\adb\adb.exe pull /sdcard/screen.png D:\adb") if getPngPix(480,2154) == (250, 157, 59): #扫描红包颜色 os.system(r"D:\adb\adb.exe shell input tap 580 2041") #点击红包 os.system(r"D:\adb\adb.exe shell screencap /sdcard/screen.png") os.system(r"D:\adb\adb.exe pull /sdcard/screen.png D:\adb") os.system(r"D:\adb\adb.exe shell input tap 557 1489") #点击开红包按钮 while True: os.system(r"D:\adb\adb.exe shell screencap /sdcard/screen.png") os.system(r"D:\adb\adb.exe pull /sdcard/screen.png D:\adb") if getPngPix(544,321) == (240, 206, 111): print("抢到红包") os.system(r"D:\adb\adb.exe shell input tap 34 165") #关闭红包界面 break else: pass else: pass
程序应用在HUAWEI Mate 30上,有需要的自行修改,如果也是HUAWEI Mate 30的可以直接使用
这篇关于利用ADB和PIL图片处理的Python抢红包工具的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python