有没有办法将 pyautogui 屏幕截图加载到 PIL 图像中?

时间:2021-01-08 20:10:08

标签: python python-imaging-library pyautogui

有没有办法将 pyautogui 屏幕截图加载到 PIL 中以供进一步使用?请看代码:

screenshot = pyautogui.screenshot()

pil_img = PIL.Image(???).load()

我已经搜索了这个问题的答案,但无济于事。谢谢。

1 个答案:

答案 0 :(得分:2)

如果您没有将文件名参数传递给 pyautogui.screenshot() 函数,则 Image 函数会自动返回一个 PIL DllNotFoundException: <dllName.dll> 对象,如 the documentation 所述。