[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:
@@ -237,8 +237,16 @@ def _rgba_png_bytes() -> bytes:
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
def test_hash_collision_media_io_config():
|
||||
data = _rgba_png_bytes()
|
||||
def _rgb_trns_png_bytes() -> bytes:
|
||||
image = Image.new("RGB", (8, 8), (255, 0, 0))
|
||||
buf = BytesIO()
|
||||
image.save(buf, format="PNG", transparency=(255, 0, 0))
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("png_bytes", [_rgba_png_bytes, _rgb_trns_png_bytes])
|
||||
def test_hash_collision_media_io_config(png_bytes):
|
||||
data = png_bytes()
|
||||
white = ImageMediaIO(rgba_background_color=(255, 255, 255)).load_bytes(data)
|
||||
black = ImageMediaIO(rgba_background_color=(0, 0, 0)).load_bytes(data)
|
||||
white2 = ImageMediaIO(rgba_background_color=(255, 255, 255)).load_bytes(data)
|
||||
|
||||
Reference in New Issue
Block a user