返回提交历史
Modified
g4f/image/__init__.py
+4
-5
XFEstudio/gpt4free
fix: convert RGBA images to RGB before saving as JPEG thumbnail
Agent-Logs-Url: https://github.com/xtekky/gpt4free/sessions/0f9b1c1f-a0a4-49a5-9793-b30940de945f Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
c406ed38
代码差异
1 个文件
+4
-5
@@ -399,11 +399,10 @@ def process_image(image: Image.Image, new_width: int = 400, new_height: int = 40
399
399
image = ImageOps.exif_transpose(image)
400
400
# Remove transparency
401
401
if image.mode == "RGBA":
402
# image.load()
403
# white = Image.new('RGB', image.size, (255, 255, 255))
404
# white.paste(image, mask=image.split()[-1])
405
# image = white
406
pass
402
image.load()
403
white = Image.new('RGB', image.size, (255, 255, 255))
404
white.paste(image, mask=image.split()[-1])
405
image = white
407
406
# Convert to RGB for jpg format
408
407
elif image.mode != "RGB":
409
408
image = image.convert("RGB")