Search code examples
pythonpython-imaging-librarypyautogui

Is there a way to load a pyautogui screenshot into a PIL image?


Is there a way to load a pyautogui screenshot into PIL for further use? Please see code:

screenshot = pyautogui.screenshot()

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

I have searched for an answer to this question, to no avail. Thanks.


Solution

  • The pyautogui.screenshot() function automatically returns a PIL Image object if you do not pass a filename argument to it, as per the documentation.