-
Notifications
You must be signed in to change notification settings - Fork 0
/
Flip.py
29 lines (23 loc) · 849 Bytes
/
Flip.py
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
import glob
import os
import PIL
from PIL import Image
def Flip(foto):
im = Image.open(foto).convert('RGB')
im = im.transpose(PIL.Image.FLIP_LEFT_RIGHT)
new_filename = os.path.splitext(foto)[0]
#new_filename = new_filename + ".jpg" + "_flipped"
new_filename = new_filename + ".jpg"
im.save(new_filename)
im.show()
if __name__ == "__main__":
dirName = 'C:\\Users\\vudan\\OneDrive\\Desktop\\Automation Project\\Odontology\\Flip-image\\test'
#saveLocation = 'C:\\Users\\vudan\\OneDrive\\Desktop\\Automation Project\\Odontology\\Flip-image\\Flipped'
#savePath = os.pardir(saveLocation)
allFiles = list()
listofFile = os.listdir(dirName)
for files in listofFile:
fullPath = os.path.join(dirName,files)
allFiles.append(fullPath)
#print(allFiles)
Flip(allFiles[1])