From b2f1c7301902f9c951316c1cdfa07d3ee31278a6 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Sat, 10 Feb 2024 11:42:53 -0300 Subject: Fix process_image to handle transparency correctly --- g4f/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g4f/image.py b/g4f/image.py index f0ee0395..29194d6e 100644 --- a/g4f/image.py +++ b/g4f/image.py @@ -166,7 +166,7 @@ def process_image(img: Image, new_width: int, new_height: int) -> Image: if img.mode != "RGB": img.load() white = new_image('RGB', img.size, (255, 255, 255)) - white.paste(img, mask=img.split()[3]) + white.paste(img, mask=img.convert('RGBA').split()[-1]) return white return img -- cgit v1.2.3