Metadata-Version: 2.4
Name: bgremove-tool
Version: 0.1.0
Summary: AI-powered background removal CLI tool - Remove image backgrounds from command line
Project-URL: Homepage, https://pypi.org/project/bgremove/
Project-URL: Repository, https://github.com/yourusername/bgremove
Project-URL: Issues, https://github.com/yourusername/bgremove/issues
Project-URL: Documentation, https://github.com/yourusername/bgremove#readme
Author-email: MAMUN <a.a.mamun595@gmail.com>
Maintainer-email: MAMUN <a.a.mamun595@gmail.com>
License-File: LICENSE
Keywords: ai,automation,background-removal,cli,command-line,image-processing,terminal
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: System :: Archiving
Classifier: Topic :: Utilities
Requires-Python: >=3.14
Requires-Dist: numpy>=2.4.4
Requires-Dist: pillow>=12.2.0
Requires-Dist: rembg[cpu]>=2.0.74
Provides-Extra: all
Requires-Dist: rembg[gpu]>=2.0.74; extra == 'all'
Requires-Dist: torch>=1.9.0; extra == 'all'
Requires-Dist: torchvision>=0.10.0; extra == 'all'
Provides-Extra: gpu
Requires-Dist: rembg[gpu]>=2.0.74; extra == 'gpu'
Requires-Dist: torch>=1.9.0; extra == 'gpu'
Requires-Dist: torchvision>=0.10.0; extra == 'gpu'
Description-Content-Type: text/markdown

# BG Remove Tool - Command Line Interface

A powerful command-line interface (CLI) tool for AI-powered background removal from images. Process single images or entire directories with simple commands.

**Author**: MAMUN (a.a.mamun595@gmail.com)

## 🚀 Quick Start

```bash
# Install from PyPI
pip install bgremove-tool

# Remove background from an image
bgremove photo.jpg

# Process multiple images in a directory
bgremove --input-dir ./photos --output-dir ./results

# Get help
bgremove --help
```

**Note**: Install with `pip install bgremove-tool`, then use the `bgremove` command. This is a command-line tool, not a Python library.

## Features

- Remove backgrounds from single images or batch process directories
- Smart output file naming: "_transparent.png" suffix for most files, "_bgremoved.png" for files already containing "transparent"
- Always outputs PNG format for transparency support
- Support for multiple input formats (PNG, JPG, JPEG, BMP, TIFF, WEBP)
- Overwrite protection with optional force overwrite
- Error handling and informative messages

## Installation

### Option 1: Install as Python Package (Recommended)

1. Clone this repository
2. Install the package:
   ```bash
   pip install -e .
   # or if using uv:
   uv pip install -e .
   ```

   This will install the `bgremove` command globally.

### Option 2: Run Directly (Cross-platform)

1. Clone this repository
2. Install dependencies:
   ```bash
   pip install -r requirements.txt
   # or if using uv:
   uv sync
   ```

3. Use the appropriate launcher for your OS:
   - **Linux/macOS**: `./bgremove.sh`
   - **Windows**: `bgremove.bat`
   - **Any OS with Python**: `python bgremove.py`

### Option 3: Direct Python Execution

```bash
python main.py [arguments]
```

## Usage

### Remove background from a single image

```bash
# If installed as package:
bgremove image.jpg

# Using launchers:
./bgremove.sh image.jpg          # Linux/macOS
bgremove.bat image.jpg           # Windows
python bgremove.py image.jpg     # Any OS

# Direct execution:
python main.py image.jpg
```

This will create `image_transparent.png` in the same directory.

### Specify output file

```bash
bgremove image.jpg -o output.png
```

### Overwrite existing output file

```bash
bgremove image.jpg --overwrite
```

### Batch process a directory

```bash
bgremove --input-dir ./images --output-dir ./output
```

This will process all supported images in `./images` and save results to `./output`.

### Get help

```bash
python main.py --help
```

## Command Line Options

- `input`: Input image file path (required for single file processing)
- `-o, --output`: Output file or directory path
- `--input-dir`: Input directory containing images to process
- `--output-dir`: Output directory for processed images
- `--overwrite`: Overwrite existing output files

## Supported Formats

- PNG
- JPG/JPEG
- BMP
- TIFF/TIF
- WEBP

## Cross-Platform Launchers

This tool provides multiple ways to run it on different operating systems:

| OS | Command | Description |
|----|---------|-------------|
| **Any OS** | `bgremove` | If installed as Python package |
| **Linux/macOS** | `./bgremove.sh` | Shell script launcher |
| **Windows** | `bgremove.bat` | Batch file launcher |
| **Any OS** | `python bgremove.py` | Python launcher script |
| **Any OS** | `python main.py` | Direct Python execution |

## Requirements

### Minimum Requirements (CPU)
- Python 3.14+
- **Memory**: At least 4GB RAM (8GB recommended for large images)
- **Storage**: ~200MB for AI models (downloaded automatically on first use)
- **Processing**: May take 10-30 seconds per image depending on hardware
- rembg[cpu] (includes ONNX Runtime for CPU inference)
- numpy
- pillow

### GPU Requirements (Optional - Faster Processing)
- CUDA-compatible GPU (NVIDIA)
- Additional ~2GB VRAM
- PyTorch with CUDA support
- rembg[gpu] (includes GPU-accelerated ONNX Runtime)
- torch>=1.9.0
- torchvision>=0.10.0

⚠️ **Performance Note**: The AI model loads ~500MB into memory. First run downloads models and may be slow. Close other memory-intensive applications.

## Distribution & Packaging

### For Developers - Building the Package

#### Using Modern Python Packaging (Recommended)

```bash
# Install build tool
pip install build

# Build distributions
python -m build

# This creates:
# dist/bgremove-0.1.0.tar.gz (source distribution)
# dist/bgremove-0.1.0-py3-none-any.whl (wheel)
```

#### Upload to PyPI

```bash
# Install upload tool
pip install twine

# Upload to PyPI (requires account)
twine upload dist/*
```

### For End Users - Installation Options

#### Option 1: Install from PyPI (when published)
```bash
# CPU version (default)
pip install bgremove

# GPU version (if you have CUDA-compatible GPU)
pip install bgremove[gpu]

bgremove image.jpg
```

#### Option 2: Install from Source
```bash
# Clone repository
git clone https://github.com/bgremove/bgremove.git
cd bgremove

# CPU version (default)
pip install -r requirements.txt
pip install -e .

# GPU version (optional, requires CUDA-compatible GPU)
pip install torch torchvision rembg[gpu]

# Use the command
bgremove image.jpg
```

#### Option 3: Standalone Usage (No Installation Required)
```bash
# Download/clone the repository
git clone https://github.com/bgremove/bgremove.git
cd bgremove

# Install dependencies
pip install -r requirements.txt

# Use appropriate launcher for your OS:
./bgremove.sh image.jpg          # Linux/macOS
bgremove.bat image.jpg           # Windows
python bgremove.py image.jpg     # Any OS with Python
```

### Package Contents

- **`bgremove/`**: Main Python package
- **`bgremove.sh`**: Linux/macOS launcher script
- **`bgremove.bat`**: Windows launcher script
- **`bgremove.py`**: Universal Python launcher
- **`pyproject.toml`**: Modern Python packaging configuration
- **`setup.py`**: Traditional setuptools configuration
- **`requirements.txt`**: Dependencies list
- **`README.md`**: Documentation
- **`LICENSE`**: MIT license

## License

Add your license here