🐞 fix(utils): fix download image

fix error when download jpg preview image which doesn't have exif data
pull/67/head
MakinoHaruka 2023-10-31 00:08:39 +08:00
parent 25228a7702
commit 4a3569829d
No known key found for this signature in database
GPG Key ID: 39F856B2368E37BE
1 changed files with 6 additions and 2 deletions

View File

@ -173,15 +173,19 @@ def resize_preview_image(input_file, output_file):
pnginfo = PngInfo()
pnginfo.add_text("parameters", image.info["parameters"])
canvas.save(output_file, image_format, pnginfo=pnginfo)
elif "exif" in image.info:
image.save(output_file, image_format, exif=image.info["exif"])
else:
canvas.save(output_file, image_format, exif=image.info["exif"])
image.save(output_file, image_format)
else:
if "parameters" in image.info:
pnginfo = PngInfo()
pnginfo.add_text("parameters", image.info["parameters"])
image.save(output_file, image_format, pnginfo=pnginfo)
else:
elif "exif" in image.info:
image.save(output_file, image_format, exif=image.info["exif"])
else:
image.save(output_file, image_format)
def calculate_file_temp_hash(file_path):