Skip to content

Commit be2d6c9

Browse files
authoredApr 17, 2021
Create T15_batch_ui.py
1 parent a810995 commit be2d6c9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

Diff for: ‎T15_batch_ui.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Written by Dorothy Tran
2+
print('Please Enter The Filename: ')
3+
infile = open(input())
4+
5+
for line in infile:
6+
7+
lst = line.split()
8+
lst[0] = copy(load_image(lst[0]))
9+
COLOUR1 = 'cyan'
10+
COLOUR2 = 'yellow'
11+
COLOUR3 = 'magenta'
12+
THRESHOLD = 10
13+
14+
for i in range (2, len(lst)):
15+
if lst[i] == '2':
16+
lst[0] = two_tone(lst[0], COLOUR1, COLOUR2)
17+
elif lst[i] == '3':
18+
lst[0] = three_tone(lst[0], COLOUR1, COLOUR2, COLOUR3)
19+
elif lst[i] == 'X':
20+
lst[0] = extreme_contrast(lst[0])
21+
elif lst[i] == 'T':
22+
lst[0] = sepia(lst[0])
23+
elif lst[i] == 'P':
24+
lst[0] = posterize(lst[0])
25+
elif lst[i] == 'E':
26+
lst[0] = detect_edges(lst[0], THRESHOLD)
27+
elif lst[i] == 'I':
28+
lst[0] = detect_edges_better(lst[0], THRESHOLD)
29+
elif lst[i] == 'V':
30+
lst[0] = flip_vertical(lst[0])
31+
elif lst[i] == 'H':
32+
lst[0] = flip_horizontal(lst[0])
33+
else:
34+
print(lst[i],'is an invalid command, please review the accepted inputs')
35+
i += 1
36+
37+
#saving the edited image with the filename
38+
save_as(lst[0], lst[1])
39+
40+
#End Program
41+
infile.close()

0 commit comments

Comments
 (0)
Please sign in to comment.