feat:新增图像编码设置

This commit is contained in:
2024-05-10 17:28:03 +08:00
parent c9605c392f
commit d753e7cad4
3 changed files with 15 additions and 6 deletions

View File

@@ -79,7 +79,7 @@ def thumbnail(input, minSize: int = 600, encode:str="webp"):
img = cv2.resize(img, newshape)
if encode == "webp":
success, encoded_image = cv2.imencode(".webp", img, [cv2.IMWRITE_WEBP_QUALITY, 75])
elif encode == "jpg":
elif encode == "jpg" or "jpeg":
success, encoded_image = cv2.imencode(".jpg", img, [cv2.IMWRITE_JPEG_QUALITY, 75])
else:
return input