Fmt
This commit is contained in:
parent
479ef92236
commit
c38d654ac7
44 changed files with 2526 additions and 701 deletions
|
|
@ -4,6 +4,7 @@ import sys
|
|||
from collections import deque
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def remove_white_bg(path: str, tolerance: int = 20, out: str | None = None):
|
||||
img = Image.open(path).convert("RGBA")
|
||||
pixels = img.load()
|
||||
|
|
@ -43,6 +44,7 @@ def remove_white_bg(path: str, tolerance: int = 20, out: str | None = None):
|
|||
img.save(dest)
|
||||
print(f"Saved to {dest} ({img.size[0]}x{img.size[1]})")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python remove_bg.py <image> [tolerance] [output]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue