Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Return a stream of RGB24 instead of a garbled mess of consecutive pngs

calleditdbf1c176106d
diff --git a/rembg/commands/b_command.py b/rembg/commands/b_command.py
index 21fc64a..702458e 100644
--- a/rembg/commands/b_command.py
+++ b/rembg/commands/b_command.py
@@ -135,9 +135,7 @@ def b_command(
os.makedirs(output_dir, exist_ok=True)
def img_to_byte_array(img: PILImage) -> bytes:
- buff = io.BytesIO()
- img.save(buff, format="PNG")
- return buff.getvalue()
+ return img.convert('RGB').tobytes("raw", "RGB")
async def connect_stdin_stdout():
loop = asyncio.get_event_loop()