-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkcloud.py
More file actions
36 lines (33 loc) · 1.07 KB
/
mkcloud.py
File metadata and controls
36 lines (33 loc) · 1.07 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
from PIL import Image
import os
def resizeImages(browserName):
try:
path = 'build/reports/geb/'+browserName
for filename in os.listdir(path):
if filename.endswith('.png'):
im = Image.open(path+"/"+filename)
size =im.size # get the size of the input image
ratio = 0.4 # reduced the size to 40% of the input image
reduced_size = int(size[0] * ratio), int(size[1] * ratio)
im_resized = im.resize(reduced_size, Image.ANTIALIAS)
im_resized.save(path+"/"+filename, "PNG")
except Exception as e:
print("There was an error during resize ")
print(e)
return('complete')
def gatherScreenshots(browserName):
final = {}
try:
path = 'build/reports/geb/'+browserName
fileNames = []
files = []
for filename in os.listdir(path):
if filename.endswith('.png'):
files.append(open(path + '/' + filename, 'rb'))
fileNames.append('file')
final = zip(fileNames, files)
except Exception as e:
print("There was an error gathering screenshots ")
print(e)
final = {}
return(final)