Skip to content

nottherajyk/Photo-background-remover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Photo Background Remover

A Python project that removes backgrounds from images using the rembg library.

Overview

This project uses the powerful rembg library to automatically detect and remove backgrounds from image files. It's useful for:

  • Creating transparent PNGs from regular photos
  • Batch processing images
  • Product photography editing
  • Profile pictures

Features

  • Automatic background removal using AI
  • Supports various image formats (JPG, PNG, etc.)
  • Simple command-line interface
  • Error handling and status messages

Requirements

  • Python 3.7+
  • rembg library
  • PIL/Pillow

Installation

  1. Clone this repository:
git clone https://github.com/YOUR_USERNAME/photo-background-remover.git
cd photo-background-remover
  1. Install dependencies:
pip install rembg pillow

Usage

Edit test_rembg.py and update the paths:

in_path = r'path/to/your/image.jpg'
out_path = r'path/to/output/image_no_bg.png'

Then run:

python test_rembg.py

The script will:

  1. Read the input image
  2. Remove the background
  3. Save the result as a PNG file with transparency

Output

  • Input: download.jpg
  • Output: download_no_bg.png (transparent background)

Project Files

  • test_rembg.py - Main script for removing backgrounds
  • hello.py - Simple test file
  • firstp.py - Additional utility file

License

MIT License - feel free to use this project for personal or commercial purposes.

Notes

  • The first run may take longer as the model is downloaded
  • The process requires a good amount of memory
  • For best results, use clear images with distinct subjects

About

I have made an Photo background remover using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages