Skip to content

redevil1/rembg-gui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rembg GUI - Background Removal Tool

A beautiful and intuitive web-based GUI for the rembg Python library. Remove image backgrounds and replace them with solid colors or custom images, similar to remove.bg.

Features

  • 🎨 Remove Background: Instantly remove backgrounds from images using AI
  • 🌈 Solid Color Background: Add any solid color as background with a color picker
  • πŸ–ΌοΈ Custom Image Background: Upload and use custom images as backgrounds
  • ⬇️ Download Options: Download both transparent and final images
  • πŸ“± Responsive Design: Works on desktop, tablet, and mobile devices
  • 🎯 Drag & Drop: Easy drag and drop interface for image upload
  • ⚑ Fast Processing: Powered by rembg for quick background removal

Screenshots

Main Interface

Main Interface

Background Removal Process

Background Removal

Solid Color Background

Solid Color Background

Custom Image Background

Custom Image Background

The application features:

  • Clean, modern interface inspired by remove.bg
  • Side-by-side comparison of original and processed images
  • Preset color options for quick background selection
  • Real-time preview of background changes

Installation

Prerequisites

  • Python 3.8 or higher
  • pip (Python package manager)

Setup

  1. Clone the repository:
git clone https://github.com/redevil1/rembg-gui.git
cd rembg-gui
  1. Create and activate a virtual environment (recommended):

On Linux/macOS:

python3 -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Open your browser and navigate to:
http://localhost:5000

Usage

Development Mode

  1. Click "Choose Image" or drag and drop an image onto the upload area
  2. Wait for the background to be removed automatically
  3. Download the transparent image using "Download Transparent" button

Production Deployment

For production use, it's recommended to:

  1. Disable debug mode by setting debug=False in app.py, or
  2. Use a production WSGI server like gunicorn:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app

Basic Background Removal

  1. Click "Choose Image" or drag and drop an image onto the upload area
  2. Wait for the background to be removed automatically
  3. Download the transparent image using "Download Transparent" button

Adding Solid Color Background

  1. After background removal, click on "Solid Color" tab
  2. Choose a color using the color picker or select from preset colors
  3. Click "Apply Color Background"
  4. Download the final image

Adding Image Background

  1. After background removal, click on "Image" tab
  2. Click "Choose Background Image" and select an image
  3. Click "Apply Image Background"
  4. Download the final image

Technology Stack

  • Backend: Flask (Python web framework)
  • Background Removal: rembg (AI-powered background removal)
  • Image Processing: Pillow (PIL)
  • Frontend: HTML5, CSS3, JavaScript (Vanilla)
  • Design: Modern gradient design with responsive layout

API Endpoints

POST /api/remove-background

Remove background from an uploaded image.

Request:

  • Form data with image file

Response:

{
  "success": true,
  "image": "data:image/png;base64,..."
}

POST /api/add-background

Add a background (color or image) to a transparent image.

Request:

{
  "foreground": "data:image/png;base64,...",
  "backgroundColor": "#ffffff"
}

OR

{
  "foreground": "data:image/png;base64,...",
  "backgroundImage": "data:image/png;base64,..."
}

Response:

{
  "success": true,
  "image": "data:image/png;base64,..."
}

Project Structure

rembg-gui/
β”œβ”€β”€ app.py                  # Flask backend application
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ templates/
β”‚   └── index.html         # Main HTML template
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css      # Styling
β”‚   └── js/
β”‚       └── script.js      # Frontend logic
β”œβ”€β”€ uploads/               # Temporary upload directory
└── outputs/               # Temporary output directory

Dependencies

  • Flask==3.0.0
  • flask-cors==4.0.0
  • rembg==2.0.57
  • Pillow==10.1.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • rembg - The amazing background removal library
  • remove.bg - Inspiration for the UI/UX design

Support

If you encounter any issues or have questions, please open an issue on GitHub.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •