From b9634aaf7ed0881f0cf637f6232956050bb212d6 Mon Sep 17 00:00:00 2001 From: calledit <1573053+calledit@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:54:16 +0100 Subject: [PATCH] Revert "rembg b - return a stream of RGB24 instead of a mess of consecutive pngs" --- rembg/commands/b_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rembg/commands/b_command.py b/rembg/commands/b_command.py index 702458e..21fc64a 100644 --- a/rembg/commands/b_command.py +++ b/rembg/commands/b_command.py @@ -135,7 +135,9 @@ def b_command( os.makedirs(output_dir, exist_ok=True) def img_to_byte_array(img: PILImage) -> bytes: - return img.convert('RGB').tobytes("raw", "RGB") + buff = io.BytesIO() + img.save(buff, format="PNG") + return buff.getvalue() async def connect_stdin_stdout(): loop = asyncio.get_event_loop()