mirror of
https://github.com/xtekky/gpt4free.git
synced 2026-04-22 15:47:11 +08:00
Merge pull request #3417 from xtekky/copilot/fix-thumbnail-creation-error
Fix RGBA image thumbnail creation failing with JPEG format
This commit is contained in:
@@ -399,11 +399,10 @@ def process_image(image: Image.Image, new_width: int = 400, new_height: int = 40
|
||||
image = ImageOps.exif_transpose(image)
|
||||
# Remove transparency
|
||||
if image.mode == "RGBA":
|
||||
# image.load()
|
||||
# white = Image.new('RGB', image.size, (255, 255, 255))
|
||||
# white.paste(image, mask=image.split()[-1])
|
||||
# image = white
|
||||
pass
|
||||
image.load()
|
||||
white = Image.new('RGB', image.size, (255, 255, 255))
|
||||
white.paste(image, mask=image.split()[-1])
|
||||
image = white
|
||||
# Convert to RGB for jpg format
|
||||
elif image.mode != "RGB":
|
||||
image = image.convert("RGB")
|
||||
|
||||
Reference in New Issue
Block a user