feat product 后处理图片size改为320*700
fix
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user