Capture & Optimization
Camera Interface
WebRTC-based camera capture with automatic device detection:Smart Resizing
Automatic optimization prevents oversized base64 encoding:Images are compressed to 80% quality (0.8) - the optimal balance between file size and AI training detail.
Aspect Ratio Options
Three professional aspect ratios available:9:16 Portrait
Optimized for Instagram Stories, TikTok, and mobile viewing
16:9 Landscape
Perfect for YouTube thumbnails, presentations, and desktop backgrounds
4:5 Classic
Instagram feed standard ratio
AI Generation Pipeline
Edge Function Processing
Images are processed through thecabina-vision Edge Function:
Polling & Timeout Handling
- Initial request timeout: 60 seconds
- Automatic polling fallback for long-running jobs
- “VAR mode” notification for connection issues
- Background processing support
Progress Indicators
Dynamic progress bar with intelligent estimates:Output Formats
Supported Formats
- PNG (default) - Lossless quality, larger file size
- JPG - Compressed, faster download
Resolution Options
- 1K - 1024px on longest side
- 2K - 2048px (future enhancement)
- 4K - 4096px (future enhancement)
Download & Share
Mobile-Optimized Sharing
Desktop Download
Direct blob download with proper CORS handling:Print Functionality
Optimized print preview window:- Auto-opens print dialog
- Maintains aspect ratio
- Maximum quality output
- Responsive to printer settings
Error Handling
Credit Refund Logic
- Failed generations automatically refund credits
- Timeout errors preserve credits
- Event credits deducted atomically in Edge Function
- User credits deducted optimistically with rollback
Performance Optimizations
- Image Compression: 80% JPEG quality reduces payload by ~60%
- Max Dimension Cap: 1024px prevents excessive memory usage
- Canvas Rendering: Hardware-accelerated preview
- Blob Conversion: Efficient memory management
- Lazy Stream Cleanup: Proper camera resource disposal