feat(新功能): 修复结果图宽度异常问题
fix(修复bug): docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -5,7 +5,7 @@ from io import BytesIO
|
||||
import cv2
|
||||
import numpy as np
|
||||
import urllib3
|
||||
from PIL import Image
|
||||
from PIL import Image, ImageDraw
|
||||
from minio import Minio
|
||||
|
||||
from app.core.config import *
|
||||
@@ -82,7 +82,7 @@ if __name__ == '__main__':
|
||||
# url = "aida-users/89/sketchboard/female/Dress/e6724ab7-8d3f-4677-abe0-c3e42ab7af85.jpeg"
|
||||
# url = "aida-users/87/print/956614a2-7e75-4fbe-9ed0-c1831e37a2c9-4-87.png"
|
||||
# url = "aida-users/89/single_logo/123-89.png"
|
||||
url = "aida-users/89/123-89.png"
|
||||
url = "aida-sys-image/models/male/65239c72-cc59-4bd6-ac17-fc828e23b450.png"
|
||||
|
||||
# url = "aida-collection-element/12148/Sketchboard/95ea577b-305b-4a62-b30a-39c0dd3ddb3f.png"
|
||||
read_type = "2"
|
||||
@@ -92,4 +92,20 @@ if __name__ == '__main__':
|
||||
cv2.waitKey(0)
|
||||
else:
|
||||
img = oss_get_image(oss_client=minio_client, bucket=url.split('/')[0], object_name=url[url.find('/') + 1:], data_type=read_type)
|
||||
draw = ImageDraw.Draw(img)
|
||||
# 获取图片尺寸
|
||||
width, height = img.size
|
||||
img
|
||||
# 计算中心点坐标
|
||||
center_x = width // 2
|
||||
center_y = height // 2
|
||||
|
||||
# 绘制垂直中心线(红色)
|
||||
draw.line(
|
||||
[(center_x, 0), (center_x, height)], # 从顶部到底部的垂直线
|
||||
fill=(255, 0, 0), # 红色 (R, G, B)
|
||||
width=2 # 线宽
|
||||
)
|
||||
|
||||
img.show()
|
||||
img.save("result.png")
|
||||
|
||||
Reference in New Issue
Block a user