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):
|
def post_processing_image(image, left, top):
|
||||||
width, height = image.size
|
resized_image = image.resize((int(image.width * (700 / image.height)), 700))
|
||||||
# 计算裁剪后的宽度和坐标
|
# 计算裁剪的坐标
|
||||||
new_width = width - 2 * left
|
left = (resized_image.width - 320) // 2
|
||||||
right = left + new_width
|
upper = 0
|
||||||
|
right = left + 320
|
||||||
|
lower = 700
|
||||||
|
|
||||||
# 进行裁剪操作
|
# 进行裁剪
|
||||||
cropped_image = image.crop((left, 0, right, height))
|
cropped_image = resized_image.crop((left, upper, right, lower))
|
||||||
|
|
||||||
# 保存裁剪后的图像,将此处的 'cropped_image.jpg' 替换为你想要保存的文件名
|
|
||||||
return cropped_image
|
return cropped_image
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user