feat product 后处理图片size改为320*700

fix
This commit is contained in:
zhouchengrong
2024-12-01 18:46:53 +08:00
parent f362c795e4
commit 96a444ca83

View File

@@ -165,15 +165,15 @@ def pre_processing_image(image_url):
def post_processing_image(image, left, top):
width, height = image.size
# 计算裁剪后的宽度和坐标
new_width = width - 2 * left
right = left + new_width
resized_image = image.resize((int(image.width * (700 / image.height)), 700))
# 计算裁剪坐标
left = (resized_image.width - 320) // 2
upper = 0
right = left + 320
lower = 700
# 进行裁剪操作
cropped_image = image.crop((left, 0, right, height))
# 保存裁剪后的图像,将此处的 'cropped_image.jpg' 替换为你想要保存的文件名
# 进行裁剪
cropped_image = resized_image.crop((left, upper, right, lower))
return cropped_image