如何在 Xorg 中获取正在运行的窗口的快照图像?
我想将 Compiz 的 Window Picker 功能迁移到 XFCE 环境,因此我需要抓取当前显示器中运行的窗口的图像,并使用 GtkWidget
显示它,但是如何呢?
I wanted to migrate Compiz's Window Picker function to XFCE environment , so i needed to grab an image of the window running in current display , and display it with an GtkWidget
, but how ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不介意依赖外部工具,可以通过调用 ImageMagick 的
import -window 0xid bmp-
来获取图像。读取管道的输出并创建适当的 GTK 对象。当然,您需要替换要从中获取图像的窗口 ID。这是 一篇文章,可帮助您获取窗口 ID来自进程 ID。
If you don't mind relying on an external tool, you can acquire the image by invoking ImageMagick's
import -window 0xid bmp-
. Read the output from a pipe and create the appropriate GTK object.Of course, you will to replace the window ID you want to get the image from. Here is a post that will help you get the window ID from a a Process ID.