-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscreenshot.py
More file actions
62 lines (52 loc) · 1.65 KB
/
screenshot.py
File metadata and controls
62 lines (52 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from PIL import ImageGrab
import os
import time
from PIL import ImageOps
from numpy import *
# global
#==========
x_pad = 467
y_pad = 84
if not os.path.exists(os.getcwd() + '\\images'):
os.makedirs(os.getcwd() + '\\images')
def snapShot(): # it was used for setting the co-ordinate of the game
box = (x_pad+1, y_pad+1, x_pad+429, y_pad+640)
im = ImageGrab.grab(box)
im = ImageGrab.grab(box)
im.save(os.getcwd() + '\\images\\actual_snap_' + str(int(time.time())) + '.png', 'PNG')
def titleColor():
box = (x_pad+101, y_pad+94, x_pad+191, y_pad+160)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print(a)
im.save(os.getcwd() + '\\actual_snap' + str(int(time.time())) + '.png', 'PNG')
return a
def colorBox_1():
box = (x_pad+160, y_pad+220, x_pad+300, y_pad+280)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print (a)
im.save(os.getcwd() + '\\actual_snap' + str(int(time.time())) + '.png', 'PNG')
return a
def colorBox_2():
box = (x_pad+160, y_pad+370, x_pad+300, y_pad+430)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print (a)
im.save(os.getcwd() + '\\actual_snap' + str(int(time.time())) + '.png', 'PNG')
return a
def colorBox_3():
box = (x_pad+160, y_pad+510, x_pad+300, y_pad+570)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print (a)
im.save(os.getcwd() + '\\actual_snap' + str(int(time.time())) + '.png', 'PNG')
return a
def main():
pass
if __name__ == '__main__':
main()