[Bugfix][Multimodal] Honor RGB PNG transparency when loading images (#61986)

Signed-off-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
Co-authored-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
This commit is contained in:
alp
2026-10-16 23:09:12 +00:00
committed by GitHub
co-authored by mottopanikeiku
parent 28e92eeff2
commit 2268d83bd9
6 changed files with 102 additions and 16 deletions
+3 -3
View File
@@ -104,12 +104,12 @@ def convert_image_mode(
to_mode: str,
background_color: tuple[int, int, int] | list[int] = (255, 255, 255),
) -> Image.Image:
if image.mode == to_mode:
return image
if to_mode == "RGB" and _has_transparency(image):
if image.mode != "RGBA":
image = image.convert("RGBA")
return rgba_to_rgb(image, background_color)
if image.mode == to_mode:
return image
return image.convert(to_mode)