复制
收藏
提问
简洁
ython截取屏幕230,70,280,90,然后打开图片
1个月前
全网
文档
学术
百科
知识库
回答简洁模式
深入研究一些
截取屏幕并打开图片
- 使用PIL库:Python Imaging Library(PIL)提供了截取屏幕的功能。
- 指定区域:通过指定坐标来截取特定区域的屏幕。
- 打开图片:使用PIL打开并显示截取的图片。
from PIL import ImageGrab, Image
# 指定截取区域的坐标
left = 230
top = 70
right = 280
bottom = 90
# 截取屏幕指定区域
img = ImageGrab.grab(bbox=(left, top, right, bottom))
# 保存截图
img.save('screenshot.png')
# 打开图片
img.show()
```<a data-index="0" class='citation' href="#citation-1" target="_blank">1</a><a data-index="1" class='citation' href="#citation-3" target="_blank">3</a><a data-index="2" class='citation' href="#citation-7" target="_blank">7</a>
你觉得结果怎么样?