Python utility for removing image backgrounds in bulk from a single file or an entire folder and exporting transparent PNGs.
- processes one file or a whole directory
- keeps filenames predictable
- writes transparent PNG outputs
- supports nested folders when scanning a directory
- works well for product mockups, icon assets, and quick cutout batches
- Python 3.10+
rembgPillow
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtProcess a folder called input/ and write results into output/:
python remove_background.py input --output outputProcess a single file:
python remove_background.py ./input/example.jpg --output ./outputUse a specific rembg model:
python remove_background.py ./input --output ./output --model u2net- The repository ignores local
input/,output/, andvenv/folders so sample images and generated assets do not bloat Git history. - Outputs are always saved as PNG so the alpha channel is preserved.