How to take screenshots using python? Last Updated : 18 Mar, 2024 Comments Improve Suggest changes Like Article Like Report Python is a widely used general-purpose language. It allows performing a variety of tasks. One of them can be taking a screenshot. It provides a module named pyautogui which can be used to take the screenshot. pyautogui takes pictures as a PIL(python image library) which supports opening, manipulating, and saving many different image file formats. Modules neededPillow: To install Pillow type the below command in the terminal. pip install Pillow pyautogui: To install pyautogui type the below command in the terminal. pip install pyautogui Below is the implementation. Python3 # Python program to take # screenshots import numpy as np import cv2 import pyautogui # take screenshot using pyautogui image = pyautogui.screenshot() # this will return the image as PIL and # store in `image` # if you need to save the image as a # file, pass the path of the file as # an argument like this image1 = pyautogui.screenshot("image1.png") Output: Comment More infoAdvertise with us Next Article How to take screenshots using python? T tarun007 Follow Improve Article Tags : Technical Scripter Python Programming Language Technical Scripter 2019 OpenCV python-modules Python-OpenCV +3 More Practice Tags : python Similar Reads How to take screenshot using Selenium in Python ? Selenium offers a lot of features and one of the important and useful feature is of taking a screenshot. In order to take a screenshot of webpage save_screenshot() method is used. save_screenshot method allows user to save the webpage as a png file. Syntax : driver.save_screenshot("image.png") Argum 1 min read Take and convert Screenshot to PDF using Python In order to take and convert a screenshot to PDF, firstly the PyAutoGUI can be used which is an automation library in python which can control mouse, keyboard and can handle many GUI control tasks. Secondly, for the conversion PIL(Python Imaging Library) of python can be used which provides image pr 3 min read How to Take a Screenshot On Microsoft Surface? Taking a screenshot on Microsoft Surface is a straightforward process that can be done using several methods. Whether you're using a Surface Pro, Surface Book, or any other Microsoft Surface device, this guide will show you how to capture the screen on Microsoft Surface efficiently. From using Micro 5 min read Python VLC MediaPlayer â Taking Screenshot In this article we will see how we can take screen shot of the MediaPlayer object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. MediPlyer object is the basic object in v 2 min read Take Screenshots at Random Intervals with Python In this article, we will learn how to take screenshots at Random Intervals with Python. Method 1: Using pyautogui.screenshot() pyautogui: The pyautogui library provides the screenshot() method, The screenshot() method is used to take a screenshot. We will use the random library and sleep() method to 5 min read Like