Skip to content

Commit

Permalink
Merge pull request #362 from samiede/main
Browse files Browse the repository at this point in the history
Update resampling method to allow use of current Pillow version
  • Loading branch information
danielgatis authored Dec 10, 2022
2 parents 1961a36 + 38d8d06 commit d62227d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rembg/session_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def normalize(
std: Tuple[float, float, float],
size: Tuple[int, int],
) -> Dict[str, np.ndarray]:
im = img.convert("RGB").resize(size, Image.Resampling.LANCZOS)
im = img.convert("RGB").resize(size, Image.LANCZOS)

im_ary = np.array(im)
im_ary = im_ary / np.max(im_ary)
Expand Down
2 changes: 1 addition & 1 deletion rembg/session_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ def predict(self, img: PILImage) -> List[PILImage]:
pred = np.squeeze(pred)

mask = Image.fromarray((pred * 255).astype("uint8"), mode="L")
mask = mask.resize(img.size, Image.Resampling.LANCZOS)
mask = mask.resize(img.size, Image.LANCZOS)

return [mask]

0 comments on commit d62227d

Please sign in to comment.