使用Python调用ImageMagick的“导入”

发布于 2024-10-10 08:30:17 字数 175 浏览 0 评论 0原文

我想使用 ImageMagick 从 Python 脚本捕获应用程序窗口的屏幕截图,就像从 shell 中使用 ImageMagick 的“导入”命令一样。来自 Python 的 API 调用或系统调用(如“subprocess.Popen([“import”...”))就足够了,但我不想在硬盘上创建文件。我的操作系统是 Linux。

I want to capture a screenshot of an application's window from a Python script using ImageMagick, as I would with ImageMagick's "import" command from a shell. An API call or a system call from Python (as in "subprocess.Popen(["import"...") will suffice, but I don't want to create a file on the hard drive. My OS is Linux.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瑶 2024-10-17 08:30:17

执行命令:

import png:-

这将导致 import 输出到 stdout。

您还可以将 png 更改为此处。

Execute the command:

import png:-

This will cause import to output to stdout.

You can also change png to one of the type tags shown here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文