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:
H Lohaus
2026-04-05 19:47:26 +02:00
committed by GitHub
+4 -5
View File
@@ -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")