Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Revert "rembg b - return a stream of RGB24 instead of a mess of consecutive pngs"

calleditb9634aaf7ed0
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()