I am learning from Al Sweigart's you tube video for automating the boring stuff. I got to the part of taking screenshots. He didn't really explain in his video so I tested things out. I found that it takes screenshots of the whole desktop but I don't know where they go. I can only find it when do a whole computer search and I don't know how to put it into a folder from there.
Basically I am asking how I can store the images and find those images taken by the pyautogui.screenshot()
function. I am not planning on using this for anything at the moment I just want to know how to do it. I went to the pyautogui website and I didn't find anything on where to find and how to save the screenshots. Thank you in advance for your time!
Here's the link to the documentation on saving screenshots in pyautogui:
https://github.com/asweigart/pyautogui#user-content-screenshot-functions
The screenshot function returns a PIL.Image. You can save that to a file with it's save method.
import pyautogui
im1 = pyautogui.screenshot()
im1.save(r"c:\path\to\my\screenshot.png")
You can also pass the path where you'd like to save the file in the screenshot method call:
import pyautogui
pyautogui.screenshot(r"c:\path\to\my\screenshot1.png")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With