A Python tool for extracting and processing receipts from images. This project provides both a command-line utility and a REST API for background removal and processing of receipt images.
- Remove backgrounds from receipt images
- Crop to content boundaries
- Enhance images for OCR processing
- Process single images or batches
- Support for both file-based and base64 image processing
- REST API with FastAPI
# Clone the repository
git clone https://github.com/David031/receipt-extractor.git
cd receipt-extractor
# Install dependencies
pip install -r requirements.txt# Process a single image
python run.py input.jpg output.jpg
# Process with OCR enhancement
python run.py input.jpg output.jpg --enhance
# Process multiple images in a directory
python run.py input_folder/ output_folder/ --batch# Start the API server
python run_api.pyThe API will be available at http://localhost:8000
GET /- Root endpoint with API informationPOST /remove-background- Remove background from an uploaded imagePOST /remove-background-base64- Remove background from a base64 encoded imagePOST /batch-process- Process multiple uploaded imagesPOST /batch-process-base64- Process multiple base64 encoded imagesGET /health- Health check endpointGET /metrics- Performance metrics endpoint
- rembg
- opencv-python
- numpy
- Pillow
- FastAPI
- scikit-image
- PyYAML
- requests
- psutil