From 5de947d3a361173d1980c46f1ef0bc9a335320e9 Mon Sep 17 00:00:00 2001 From: Sami Ede Date: Fri, 9 Dec 2022 15:40:30 +0100 Subject: [PATCH 1/2] update to current PIL version --- rembg/session_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rembg/session_base.py b/rembg/session_base.py index df140115..aa98693b 100644 --- a/rembg/session_base.py +++ b/rembg/session_base.py @@ -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) From 79ab2b0ad073aa1e18e05c460b8142a72008668b Mon Sep 17 00:00:00 2001 From: Sami Ede Date: Fri, 9 Dec 2022 15:57:45 +0100 Subject: [PATCH 2/2] remove resampling from session_simple --- rembg/session_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rembg/session_simple.py b/rembg/session_simple.py index 511cdca0..7ec31813 100644 --- a/rembg/session_simple.py +++ b/rembg/session_simple.py @@ -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]