Skip to content

Commit

Permalink
fix alpha matting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgatis committed Apr 18, 2022
1 parent f72fe5f commit 92e768c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rembg/bg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 92e768c

Please sign in to comment.