A modern, AI-powered image editor for professional background removal, shadow effects, and photo enhancement
Features • Tech Stack • Installation • Usage • API Integration
ImaGen Editor is a cutting-edge web-based image editing application that harnesses the power of Bria AI to transform ordinary images into professional-quality visuals. Whether you're an e-commerce seller preparing product photos, a digital creator enhancing content, or a casual user looking to remove backgrounds, ImaGen Editor provides studio-quality results with just a few clicks.
Built on Streamlit for a seamless user experience and powered by Bria AI's advanced computer vision models, this tool eliminates the need for complex software like Photoshop while delivering comparable results.
- One-Click Background Removal - AI-powered subject isolation with pixel-perfect accuracy
- Custom Background Colors - Apply any color to match your brand or style
- Transparent Backgrounds - Perfect for logos, products, and overlay graphics
- Smart Edge Detection - Preserves fine details like hair, fur, and transparent objects
Add depth and realism to your images with professional shadow tools:
- Drop Shadows - Classic shadow effects for emphasis
- Natural Shadows - Realistic ground shadows for products
- Customizable Parameters:
- Shadow blur intensity
- X/Y offset positioning
- Shadow color selection
- Opacity control (0-100%)
- Shadow dimensions (width/height)
Optional AI-powered content filtering to ensure uploaded images meet community standards.
Tag images with custom labels or Stock Keeping Units for inventory and organization.
Instantly compare original and edited versions with real-time preview functionality.
Export edited images in PNG format with full resolution and transparency support.
- Clean, modern design
- Tabbed editing workflow
- Expandable control panels
- Responsive layout for all devices
- Real-time processing feedback
| Technology | Purpose | Version |
|---|---|---|
| Primary programming language | 3.8+ | |
| Web application framework | Latest | |
| AI-powered image processing | API v1 | |
| Image manipulation library | Latest |
| Library | Purpose |
|---|---|
| Requests | HTTP client for API communication |
| Python-dotenv | Environment variable management |
| Python-magic | File type validation |
| Base64 | Image encoding for API transmission |
| IO | In-memory image operations |
┌─────────────────────────────────────────────────────────────┐
│ STREAMLIT USER INTERFACE │
│ (app.py) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ API Key │ │ Background │ │ Shadow │ │
│ │ Settings │ │ Editor Tab │ │ Editor Tab │ │
│ └──────────────┘ └──────────────┘ └──────────────────┘ │
│ │ │ │ │
│ └─────────────────┴────────────────────┘ │
│ │ │
└───────────────────────────┼─────────────────────────────────┘
│
┌──────▼──────┐
│ Components │
│ - uploader │
│ - preview │
└──────┬──────┘
│
┌───────────────────────────▼─────────────────────────────────┐
│ SERVICE LAYER │
│ │
│ ┌─────────────────┐ ┌─────────────────────┐ │
│ │ Background │ │ Shadow │ │
│ │ Service │ │ Service │ │
│ │ (packshot.py) │ │ (shadow.py) │ │
│ └────────┬────────┘ └──────────┬──────────┘ │
│ │ │ │
│ └──────────────┬───────────────────┘ │
└──────────────────────────┼─────────────────────────────────┘
│
┌──────▼──────┐
│ Bria AI │
│ API │
│ │
│ Endpoints: │
│ - /packshot│
│ - /shadow │
│ - /rmbg │
└──────┬──────┘
│
┌──────▼──────┐
│ Processed │
│ Images │
│ (PNG) │
└─────────────┘
- User uploads image (PNG, JPG, JPEG)
- File type validation using python-magic
- Image preview displayed in interface
- File converted to bytes for processing
Background Removal:
- Image encoded to base64
- Sent to Bria AI
/background/removeendpoint - AI analyzes image and isolates subject
- Returns processed image with transparent background
Color Application:
- Processed image sent to
/packshotendpoint - Custom background color applied
- Optional SKU tagging
- High-quality PNG generated
- User selects shadow type (drop/natural)
- Customizes shadow parameters
- Image sent to
/product/shadowendpoint - AI generates realistic shadow effects
- Returns final composite image
- Side-by-side comparison displayed
- Download button for high-res PNG
- Original preserved for further editing
Experience ImaGen Editor in action:
https://imagen-image-background-generator.streamlit.app
Hosted on Streamlit Cloud for instant access without installation
- Python 3.8 or higher
- pip package manager
- Git
- Bria AI API Key (Get it here)
- Clone the repository
git clone https://github.com/PasinduSuraweera/ImaGen-App.git
cd ImaGen-App- Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Configure API credentials
Create a .env file in the project root:
BRIA_API_KEY=your_bria_api_key_here- Run the application
streamlit run app.py- Access the application Open your browser and navigate to:
http://localhost:8501
streamlit>=1.28.0
pillow>=10.0.0
requests>=2.31.0
python-dotenv>=1.0.0
python-magic>=0.4.27Option A: Environment Variable (Recommended)
# In .env file
BRIA_API_KEY=your_api_key_hereOption B: Manual Entry
- Open the sidebar in the app
- Enter API key in the text field
- Key is stored in session state
Navigate between two powerful editors:
Perfect for product photos, profile pictures, and graphics.
Add professional depth and realism to isolated subjects.
- Click "Upload Image" button
- Select PNG, JPG, or JPEG file
- Preview appears instantly
- File validation ensures quality
Background Editor Options:
- ✅ Transparent Background - Remove background completely
- 🎨 Background Color - Pick any hex color
- 🏷️ SKU - Add product identifier (optional)
Shadow Editor Options:
- 🌫️ Shadow Type - Drop or Natural
- 🎨 Shadow Color - Choose shadow hue
- 📏 Shadow Offset - X/Y positioning
- 💡 Shadow Intensity - Opacity (0-100%)
- 🌀 Shadow Blur - Softness level
- 📐 Shadow Dimensions - Width/height control
- Click "Process Image" button
- Wait for AI processing (2-5 seconds)
- View side-by-side comparison
- Click "Download" to save PNG
1. Upload product image with messy background
2. Enable "Transparent Background"
3. Process image
4. Switch to Shadow Editor
5. Add natural shadow with 70% intensity
6. Download final image for store listing
1. Upload portrait photo
2. Apply solid color background (#FFFFFF)
3. Process to remove original background
4. Download professional headshot
1. Upload logo on colored background
2. Enable transparent background
3. Process for clean isolation
4. Use in presentations and websites
ImaGen-App/
│
├── app.py # Main Streamlit application
│
├── services/ # Image processing services
│ ├── __init__.py
│ ├── packshot.py # Background removal & color
│ ├── shadow.py # Shadow effects
│ └── background_service.py # Background utilities
│
├── components/ # UI components
│ ├── uploader.py # File upload component
│ └── image_preview.py # Preview component
│
├── assets/ # Static assets
│ └── Screenshot3.png # Preview image
│
├── .env # Environment variables (not in git)
├── .env.example # Environment template
├── .gitignore # Git ignore rules
├── requirements.txt # Python dependencies
└── README.md # Project documentation
ImaGen Editor integrates with Bria AI's powerful image processing APIs:
POST https://engine.prod.bria-api.com/v1/background/remove
Purpose: Isolate subjects from backgrounds with AI precision
POST https://engine.prod.bria-api.com/v1/product/packshot
Purpose: Apply custom backgrounds and prepare product photos
POST https://engine.prod.bria-api.com/v1/product/shadow
Purpose: Add realistic drop or natural shadow effects
All requests require an API token in headers:
headers = {
'api_token': 'your_api_key',
'Accept': 'application/json',
'Content-Type': 'application/json'
}For detailed API documentation, visit Bria AI Docs
- Clean, minimalist design
- Professional color scheme
- Intuitive navigation
- Two-column comparison view
- Expandable control panels
- Mobile-friendly design
- Real-time feedback
- Progress indicators
- Error handling with clear messages
- Keyboard shortcuts support
- ✅ API keys stored securely in environment variables
- ✅ No data retention - images processed in real-time
- ✅ File validation prevents malicious uploads
- ✅ HTTPS communication with API endpoints
- ✅ Optional content moderation for safe uploads
- 🚀 Fast API Response - 2-5 second processing time
- 💾 Efficient Memory Usage - In-memory operations
- 🔄 Session State Management - Preserves user data
- 📦 Optimized Image Encoding - Base64 compression
| Problem | Solution |
|---|---|
| API Key Not Working | Verify key is set in .env as BRIA_API_KEY |
| Upload Fails | Ensure file is PNG, JPG, or JPEG format |
| API Error 422 | Image may be blocked by content moderation |
| Image Not Displaying | Check if valid image URL returned from API |
| Slow Processing | Large images take longer; consider resizing |
| .env Not Loading | Ensure .env file is in project root directory |
- 🎨 Batch Processing - Edit multiple images at once
- 📐 Image Resizing - Smart crop and resize tools
- 🎭 Filter Effects - Apply artistic filters and adjustments
- 💾 History Management - Undo/redo functionality
- 🖼️ Template Library - Pre-designed backgrounds and styles
- 🎯 Smart Crop - AI-powered composition suggestions
- 🌈 Color Palette Generator - Extract colors from images
- 📊 Image Analytics - Size, dimensions, color analysis
- 🔗 Direct Social Media Export - Share to platforms
- 🎪 Advanced Effects - Blur, vignette, lighting
- 📱 Mobile App - iOS and Android versions
- 🤝 Collaboration Tools - Share and comment on edits
Contributions are welcome! Help make ImaGen Editor even better.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
- 🎨 New image effects and filters
- 🔧 Performance optimizations
- 📚 Documentation improvements
- 🐛 Bug fixes
- 🌐 Internationalization
- ♿ Accessibility enhancements
This project is licensed under the MIT License - see the LICENSE file for details.
Pasindu Suraweera
- 🐙 GitHub: @PasinduSuraweera
- 🌐 Live Demo: ImaGen Editor
- 💼 LinkedIn: Connect with me
- 🎨 Bria AI - Powerful image processing APIs
- 🚀 Streamlit - Rapid web app development
- 🖼️ Pillow - Python imaging library
- 🐍 Python - The language that powers it all
- 💙 The open-source community
Need help or have questions?
- Product photography
- Catalog preparation
- Marketplace listings
- Ad creative
- YouTube thumbnails
- Social media graphics
- Blog post images
- Marketing materials
- Headshots and portraits
- Real estate photos
- Resume pictures
- Profile images
- Logo preparation
- Brand assets
- Presentation graphics
- Print materials