A small Python utility that strips the background from an image using rembg and Pillow, producing a transparent PNG.
- Python 3.9+
git clone https://github.com/CodeWithCrescent/python_image_bg_remover.git
cd python_image_bg_remover
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt-
Drop the image you want to process into the
inputs/folder. -
Update the filename in main.py to point to your image:
input = Image.open("inputs/your_image.jpg")
-
Run the script:
python3 main.py
-
The background-removed image is saved to
outputs/output.png.
.
├── inputs/ # Source images
├── outputs/ # Generated, background-removed images
├── main.py # Entry point
└── requirements.txt
Licensed under the MIT License.