Skip to content

Commit

Permalink
bugfix: 修复Pillow 10 的API变动导致的出错 fix #938
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Nov 15, 2023
1 parent b397350 commit b5980ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/models/OpenAIVision.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def image_to_base64(image_path):
# 按压缩比例调整图片大小
new_width = int(width * scale_ratio)
new_height = int(height * scale_ratio)
img = img.resize((new_width, new_height), Image.ANTIALIAS)
img = img.resize((new_width, new_height), Image.LANCZOS)

# 将图片转换为jpg格式的二进制数据
buffer = BytesIO()
Expand Down
2 changes: 1 addition & 1 deletion modules/models/XMChat.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def image_to_base64(self, image_path):
# 按压缩比例调整图片大小
new_width = int(width * scale_ratio)
new_height = int(height * scale_ratio)
img = img.resize((new_width, new_height), Image.ANTIALIAS)
img = img.resize((new_width, new_height), Image.LANCZOS)

# 将图片转换为jpg格式的二进制数据
buffer = BytesIO()
Expand Down

0 comments on commit b5980ba

Please sign in to comment.