dongchangxi 11 months ago
parent
commit
95b4c7437b
  1. 6
      new_studio_to_reg/tools_to_xmps.py

6
new_studio_to_reg/tools_to_xmps.py

@ -24,12 +24,18 @@ def clearExifAndRotate(imagePath, rotate=90): @@ -24,12 +24,18 @@ def clearExifAndRotate(imagePath, rotate=90):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {imagePath} 图片exif信息清除并且旋转...')
# 打开图像
try:
with Image.open(imagePath) as img:
# 使用RGB模式打开图像来丢弃可能存在的EXIF信息
img = img.convert("RGB")
img = img.rotate(rotate,expand=True)
# 保存图像,保存时不会带有原始的任何元数据
img.save(imagePath, quality=100) # 对于JPEG,可以调整质量参数
except Exception as e:
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {imagePath} 图片处理失败,原因:{e}')
#移除该张图片
os.remove(imagePath)
return
#如果老影棚没有做过旋转坐标的照片的,则要做一次旋转坐标
def rateImages(pid):

Loading…
Cancel
Save