-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_img.py
More file actions
25 lines (23 loc) · 780 Bytes
/
test_img.py
File metadata and controls
25 lines (23 loc) · 780 Bytes
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
from PIL import Image
import os
path = './images/'
import shutil
if not os.path.exists('./deleted'):
os.makedirs('./deleted')
print(len(os.listdir(path)))
counter = 0
with open('delete.txt', 'w+') as f:
for file in os.listdir(path):
extension = file.split('.')[-1]
if extension == 'jpg' or extension == 'png':
counter+=1
fileLoc = path+file
img = Image.open(fileLoc)
if img.mode != 'RGB':
pass
#shutil.move('./images/'+file, './deleted/')
#print("./annotations/"+file[0:-3]+'xml')
#shutil.move("./annotations/"+file[0:-3]+'xml', './deleted/')
else:
print(file)
print(counter)