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. This module along with
OpenCV provides the way to manipulate and save the images (screenshot in this case)
pyautogui takes pictures as a PIL(python image library) which supports opening, manipulating, and saving many different image file formats. Then we need to convert the image to NumPy array, so that it can be converted from RGB to BGR because when the image file is read with the OpenCV using
imread(), the order of colors should be BGR (blue, green, red).
- Numpy: To install Numpy type the below command in the terminal.
pip install numpy
- pyautogui: To install pyautogui type the below command in the terminal.
pip install pyautogui
- OpenCV: To install OpenCV type the below command in the terminal.
pip install opencv-python
Below is the implementation.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Taking Screenshots using pyscreenshot in Python
- How to take screenshot using Selenium in Python ?
- Python | Pandas dataframe.take()
- Python | Pandas TimedeltaIndex.take()
- Python | Pandas Series.take()
- Take Matrix input from user in Python
- Python | Numpy matrix.take()
- Take input from stdin in Python
- Create a Python Script Notifying to take a break
- How to take integer input in Python?
- numpy.take() in Python
- What is Hactoberfest and How One Can Take Participate in it?
- Python | Create video using multiple images using OpenCV
- Python | Create a stopwatch using clock object in kivy using .kv file
- Image resizing using Seam carving using OpenCV in Python
- Visualizing Tiff File Using Matplotlib and GDAL using Python
- Python | Visualizing O(n) using Python
- Python - Read blob object in python using wand library
- Creating and updating PowerPoint Presentations in Python using python - pptx
- Circular (Oval like) button using canvas in kivy (using .kv file)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.