修正heic图片保存问题

This commit is contained in:
2024-10-21 09:32:39 +08:00
parent da18d890f7
commit 3044f1fc08

View File

@@ -42,6 +42,8 @@ def split(img_path, ratio=1.414, overlap=0.05, x_compensation=3):
wh_ratio = width / height wh_ratio = width / height
img_name, img_ext = common_util.parse_save_path(img_path) img_name, img_ext = common_util.parse_save_path(img_path)
if img_ext == 'heic' or img_ext == 'HEIC':
img_ext = 'jpg' # cv2无法保存heic图片
if hw_ratio > ratio: # 纵向过长 if hw_ratio > ratio: # 纵向过长
new_img_height = width * ratio new_img_height = width * ratio
step = width * (ratio - overlap) # 偏移步长 step = width * (ratio - overlap) # 偏移步长