Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

fix alpha matting

Daniel Gatis92e768c3fa52
diff --git a/rembg/bg.py b/rembg/bg.py
index 6a48f7d..7ff1fa7 100644
--- a/rembg/bg.py
+++ b/rembg/bg.py
@@ -90,7 +90,10 @@ def remove(
if session is None:
session = ort_session("u2net")
- mask = predict(session, np.array(img.convert("RGB"))).convert("L")
+ img = img.convert("RGB")
+
+ mask = predict(session, np.array(img))
+ mask = mask.convert("L")
mask = mask.resize(img.size, Image.LANCZOS)
if only_mask: