简体   繁体   English

如何在 Linux 中使用 Pyautogui 快速捕获屏幕

[英]How can I capture the screen fast using Pyautogui in Linux

I am trying to create a bot for a game.我正在尝试为游戏创建一个机器人。 Therefore I need to capture the screen however the Pyautogui's screenshot function is too slow for a game.因此我需要捕获屏幕但是 Pyautogui 的屏幕截图 function 对于游戏来说太慢了。 How can I capture the screen directly without using the module.如何在不使用模块的情况下直接捕获屏幕。 I tried looking for answer but the only thing I found were answers for mac or windows.我试图寻找答案,但我发现的唯一东西是 mac 或 windows 的答案。 Now I know there are many ways to capture a X window but which of them are actually fast enough for getting at least 30 FPS.现在我知道有很多方法可以捕获 X window,但它们中的哪些实际上足够快以获得至少 30 FPS。

None of them.他们都没有。 A full HD screen is about 8 MB.全高清屏幕约为 8 MB。 GPUs are optimized for getting data INTO memory, not getting data OUT of memory. GPU 已针对将数据输入 memory 进行了优化,而不是将数据从 memory 输出。 The read path is always lower priority.读取路径的优先级始终较低。 When you add the overhead of Python, you are never going to get 30 FPS.当您添加 Python 的开销时,您永远不会获得 30 FPS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM