使用 Python 选择屏幕区域 [英] Selecting area of the screen with Python
问题描述
我正在用 Python 开发屏幕截图实用程序.目前它专门用于Linux.到目前为止,我已经能够拍摄完整桌面的屏幕截图,并将其上传到 Imgur,然后将链接复制到剪贴板.现在我想扩展到诸如活动窗口或特定选择的屏幕截图之类的功能.如果有人可以提供帮助,我很想知道哪种模块最适合于此,以及如何实现这样的模块.
I'm developing a screen shot utility in Python. At the moment it is specifically for Linux. So far I have the ability to take a screen shot of the full desktop, and have it upload to Imgur, then copy the link to clipboard. Now I want to expand into functions such as screen shots of the active window, or of a specific selection. If anyone could help, I'd love to know what kind of module would work best for this, and how to implement such a module.
推荐答案
功能将取决于您用于图像抓取的内容.
The functionality will depend on what you are using for image grabbing.
使用 PIL
- http://effbot.org/imagingbook/imagegrab.htm
- http://library.gnome.org/devel/gdk-pixbuf/
- http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html
使用 GTK
要截取活动窗口的屏幕截图:
To take a screenshot of active window :
还要看pixbuf api
Also look at the pixbuf api
离题
有一些截屏工具:http://pypi.python.org/pypi/castro/1.0.4
这篇关于使用 Python 选择屏幕区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!