1
This commit is contained in:
1 parent
6f8f34c4ac
commit
f6ae9afe44
1 file changed
+12
-6
@@ -46,16 +46,22 @@ def clearExifAndRotate(imagePath, rotate=180):
|
||||
#如果老影棚没有做过旋转坐标的照片的,则要做一次旋转坐标
|
||||
def rateImages(pid):
|
||||
#遍历文件夹下的所有图片
|
||||
photo1_path = os.path.join(config.workdir, pid, 'photo1')
|
||||
# photo1_path = os.path.join(config.workdir, pid, 'photo1')
|
||||
photo2_path = os.path.join(config.workdir, pid, 'photo2')
|
||||
for pic in os.listdir(photo1_path):
|
||||
if pic.endswith('.jpg'):
|
||||
#清除图片exif信息, 旋转图片 180度
|
||||
clearExifAndRotate(os.path.join(photo1_path, pic))
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pic} 图片exif信息清除并且旋转完成')
|
||||
# for pic in os.listdir(photo1_path):
|
||||
# if pic.endswith('.jpg'):
|
||||
# #清除图片exif信息, 旋转图片 180度
|
||||
# clearExifAndRotate(os.path.join(photo1_path, pic))
|
||||
# print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pic} 图片exif信息清除并且旋转完成')
|
||||
|
||||
for pic in os.listdir(photo2_path):
|
||||
if pic.endswith('.jpg'):
|
||||
#判断文件大小
|
||||
if os.path.getsize(os.path.join(photo2_path, pic)) < 1024 * 1024:
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pic} 图片大小小于1M,不做处理')
|
||||
#删除小于1M的图片
|
||||
os.remove(os.path.join(photo2_path, pic))
|
||||
continue
|
||||
#清除图片exif信息, 旋转图片 180度
|
||||
clearExifAndRotate(os.path.join(photo2_path, pic))
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pic} 图片exif信息清除并且旋转完成')
|
||||
|
||||
Reference in new issue
Block a user