mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-30 15:31:07 +00:00
15 lines
387 B
Python
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)
|