Hello, internet programmer today we code to take a screenshot using python. As you know python is amazing blah blah… let’s code.
We pyscreenshot module to take screenshots using python.
pip install pyscreenshot
pyscreenshot module is obsolete in most cases. It was created because PIL ImageGrab module worked on Windows only, but now Linux and macOS are also supported by Pillow. There are some features in
pyscreenshot which can be useful in special cases: flexible backends, Wayland support, sometimes better performance, optional subprocessing.
For handling image memory (e.g. saving to file, converting,..) please read Pillow documentation.
# Follow @code_snail import pyscreenshot as ImageGrab import datetime import time time.sleep(3) # tell me why I used delay here... im = ImageGrab.grab() im.save("screenshot-" + str(datetime.datetime.now()) + ".png") im.show()
After executing code, image is saved in the same location where your code is saved.
Happy coding 🙂 follow me on Instagram @code_snail
You may also like,