-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimageTools.pyw
87 lines (75 loc) · 2.44 KB
/
imageTools.pyw
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
__author__ = 'Colby'
import ImageGrab
import ImageOps # used for grayscaling
from numpy import *
import os
import time
x_pad = 363
y_pad = 344
# grabs the game screen, used for getting image coordinates
def screenGrab():
box = (x_pad+1, y_pad+1, x_pad+1601, y_pad+1201)
im = ImageGrab.grab(box)
im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) + '.png', 'PNG')
return im
# grab customer order images, used for determining sushi type
def grabOrderOne():
box = (x_pad+66,y_pad+154,x_pad+66+150,y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_one__' + str(int(time.time())) + '.png', 'PNG')
return a
def grabOrderTwo():
box = (x_pad+319, y_pad+154, x_pad+319+150, y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_two__' + str(int(time.time())) + '.png', 'PNG')
return a
def grabOrderThree():
box = (x_pad+571, y_pad+154, x_pad+571+150, y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_three__' + str(int(time.time())) + '.png', 'PNG')
return a
def grabOrderFour():
box = (x_pad+824, y_pad+154, x_pad+824+150, y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_four__' + str(int(time.time())) + '.png', 'PNG')
return a
def grabOrderFive():
box = (x_pad+1076, y_pad+154, x_pad+1076+150, y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_five__' + str(int(time.time())) + '.png', 'PNG')
return a
def grabOrderSix():
box = (x_pad+1329, y_pad+154, x_pad+1329+150, y_pad+154+30)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
# im.save(os.getcwd() + '\\order_six__' + str(int(time.time())) + '.png', 'PNG')
return a
def getAllOrders():
grabOrderOne()
grabOrderTwo()
grabOrderThree()
grabOrderFour()
grabOrderFive()
grabOrderSix()
def main():
screenGrab()
# Python convention to check if script is top level (only executes if ran by itself)
if __name__ == '__main__':
main()