Awesome-Python-Scripts/Take_screenshot/screenshot.py
Moad Mohammed Elhebri b9a78e3a1d
Add files via upload
2019-01-19 05:43:59 +08:00

15 lines
387 B
Python

#Needed packages
import numpy as np
import cv2
import pyautogui
#take screenshot using pyautogui
image = pyautogui.screenshot()
#since the pyautogui takes as a PIL(pillow) and in RGB we need to convert it to numpy array and BGR
#so we can write it to the disk
image = cv2.cvtColor(np.array(image),cv2.COLOR_RGB2BGR)
#writing it to the disk using opencv
cv2.imwrite("test.png",image)