Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

chore: Update .gitignore and add .python-version file

Daniel Gatised1c29576fde
diff --git a/.gitignore b/.gitignore
index 803ad0c..300f493 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@ __pycache__/
*~≈
.env
.envrc
-.python-version
.idea
.pytest_cache
diff --git a/.python-version b/.python-version
new file mode 100644
index 0000000..455808f
--- /dev/null
+++ b/.python-version
@@ -0,0 +1 @@
+3.12.4
diff --git a/rembg/bg.py b/rembg/bg.py
index 76ebb1c..431636b 100644
--- a/rembg/bg.py
+++ b/rembg/bg.py
@@ -241,13 +241,13 @@ def remove(
"""
if isinstance(data, bytes) or force_return_bytes:
return_type = ReturnType.BYTES
- img = Image.open(io.BytesIO(cast(bytes, data)))
+ img = cast(PILImage, Image.open(io.BytesIO(cast(bytes, data))))
elif isinstance(data, PILImage):
return_type = ReturnType.PILLOW
- img = data
+ img = cast(PILImage, data)
elif isinstance(data, np.ndarray):
return_type = ReturnType.NDARRAY
- img = Image.fromarray(data)
+ img = cast(PILImage, Image.fromarray(data))
else:
raise ValueError(
"Input type {} is not supported. Try using force_return_bytes=True to force python bytes output".format(