mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Add files via upload
This commit is contained in:
parent
3591334c29
commit
b9a78e3a1d
14
Take_screenshot/screenshot.py
Normal file
14
Take_screenshot/screenshot.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#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)
|
BIN
Take_screenshot/test.png
Normal file
BIN
Take_screenshot/test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 272 KiB |
Loading…
Reference in New Issue
Block a user