通过选择区域从python脚本中截取屏幕截图 [英] Taking screenshot from a python script by selecting the area

查看:450
本文介绍了通过选择区域从python脚本中截取屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了该帖子(确实很有帮助:拍摄屏幕截图通过python脚本[Linux] )来获取来自python的屏幕截图.它运作良好,但我希望具有与gnome-screenshot相同的行为:可以在以下选项之间进行选择:

I saw that post (that is really helpful : Take a screenshot via a python script. [Linux]) about taking a screenshot from python. It works well but I'd like to have the same behavior as gnome-screenshot : having the possibility to choose between :

  • 捕获整个桌面
  • 捕获活动窗口
  • 捕获区域

是否有办法在python中执行此操作,或者最终使用gnome-screenshot应用程序执行此操作,然后获取文件?

Is there a way to do this in python, or, eventually, to use the gnome-screenshot application to do it, and then getting the file ?

我试图通过提供调用路径来找到启动gnome-screenshot的完美命令行,而无需询问在何处保存屏幕截图,但是我找不到它.

I tried to find the perfect command line for gnome-screenshot to be launched without asking where to save the screenshot after by giving the path at the call, but I can't find it.

感谢您的帮助!

推荐答案

如果您不仅限于使用gnome-screenshot,ImageMagick的import命令可以直接保存到文件中,而无需交互式提示.

If you are not limited to using using gnome-screenshot specifically, ImageMagick's import command can save directly to file without an interactive prompt.

有关详细信息,请参见此处: http://www.imagemagick.org/script/import.php

See here for details: http://www.imagemagick.org/script/import.php

除了命令行界面外,还有一个 Python API

In addition to the command line interface, there is also a Python API.

这篇关于通过选择区域从python脚本中截取屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆