Feature: Add image file support for invoice uploads
Resolved 💬 1 comment Opened Aug 21, 2025 by blukraken Closed Aug 21, 2025
Feature Request: Image File Support for Invoice Processing
Description
Currently, the invoice processing system only supports PDF and DOCX file formats. We need to add support for image file formats to handle scanned invoices and photos taken of paper invoices.
Supported Formats to Add
- JPG/JPEG - Most common format for photos
- PNG - High quality scanned documents
- TIFF - Professional scanning format
- BMP - Basic bitmap support
Current Implementation
- The system uses PaddleOCR which already supports image formats
- File validation is currently restricted to
.pdfand.docxinservices/invoice_processing_service.py - Pattern extraction and job processing should work identically for images
Required Changes
1. Update File Validation
- Modify
ALLOWED_FILE_TYPESinInvoiceProcessingService - Add image MIME type validation
- Consider file size limits for high-resolution images
2. OCR Service Updates
- Verify PaddleOCR handles all image formats correctly
- Test quality/confidence scores for different image types
- Add image preprocessing if needed (rotation, contrast enhancement)
3. File Organization
- Update file storage paths to handle image files appropriately
- Ensure proper thumbnail generation for web interface (future)
4. Testing Requirements
- Test with real invoice images from various sources
- Validate OCR quality across different image types
- Ensure pattern extraction works with image-based OCR text
Priority
Medium - Not blocking current functionality, but important for user convenience and mobile upload capabilities.
Acceptance Criteria
- [ ] JPG, PNG, TIFF, and BMP files can be uploaded via
/invoices/uploadendpoint - [ ] OCR processing works correctly for all image formats
- [ ] Pattern extraction maintains same accuracy as PDF processing
- [ ] File organization follows existing truck/vendor categorization
- [ ] Error handling provides clear feedback for unsupported/corrupted images
- [ ] Integration tests pass with real invoice images
Technical Notes
- PaddleOCR documentation: https://github.com/PaddlePaddle/PaddleOCR
- Consider image preprocessing for better OCR results
- Mobile devices often capture images at various orientations
Related Files
services/invoice_processing_service.py- File validationservices/ocr_service.py- OCR processingapi/invoices.py- Upload endpointschemas/invoice.py- Response schemas
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗