- Add zoom support via prop (scales image around center)
- Fix selection interaction: clicking on selection transforms, clicking elsewhere creates new
- Use refs for state accessed in event handlers (fixes stale closure issue)
- Add smart select mode (clicks call onSmartSelect with image coordinates)
- Add color select mode placeholder
- Add pan mode with cursor feedback
- Add move mode for manipulating selections
- Use dashed blue selection style (more visible)
- forwardRef to expose canvas methods
Frontend changes:
- Wire Smart Select and Color Select to canvas click handlers
- Add externalSelection prop to ImageCanvas for displaying AI-generated selections
- Add zoom controls (mouse wheel + buttons) to ImageCanvas
- Fix layer buttons (New Layer, Delete, Duplicate) with proper handlers
- Lift advancedToolMode state to App.jsx for coordination between components
- Add tool mode indicator overlay on canvas
Backend changes:
- Update smart-select endpoint to return JSON with polygon and bbox data
- Update color-select endpoint to return JSON with polygon and bbox data
- Add _mask_to_polygon helper function using OpenCV contour detection
- Add cv2 and base64 imports to tools.py
API changes:
- smartSelect and colorSelect now return { polygon, bbox, mask_base64 }
Fixes:
- Remove scale limit to allow image to fill canvas
- Fix Lasso tool by using Polygon instead of Polyline
- Remove duplicate Clear Selection button
- Fix Undo/Redo dependencies with useCallback
New Features:
- Eye Catalog UI for browsing and applying saved eyes
- Upload new eyes to catalog
- Apply eyes to selected areas with feathering
- Delete eyes from catalog
- Make canvas use full viewport height for larger image display
- Add download button to export edited images
- Implement Undo/Redo with Ctrl+Z / Ctrl+Y keyboard shortcuts
- Add transform controls for selections (move, resize, rotate)
- Add warn on reload to prevent data loss
- Make project naming optional, auto-generate from filename
This commit implements a full-stack AI photo editing application that
allows users to regenerate only selected areas of images using AI.
Features implemented:
- Frontend (React + Fabric.js):
* Interactive canvas with selection tools (rectangle, ellipse, lasso)
* Real-time selection preview and editing
* Mode toggle (A: patch only, B: patch + context)
* Feather slider for edge blending (0-50px)
* Prompt input for AI instructions
* Edit history viewer with revert capability
* Responsive UI with dark theme
- Backend (FastAPI):
* RESTful API for projects and edits
* SQLite database for metadata storage
* Image processing pipeline with PIL/OpenCV
* AI provider interface (pluggable)
* Support for OpenAI, Stability AI, and mock providers
* Feathered alpha blending for smooth compositing
* Complete edit history tracking
* File-based storage for images and edits
- Image Processing:
* Patch extraction from bounding boxes
* Mask generation for all selection types
* Feathered edge blending
* Patch compositing back to full image
* No pixels modified outside selection
* All edits reversible
- Infrastructure:
* Docker Compose orchestration
* Production and development configurations
* Nginx reverse proxy for frontend
* Hot-reload support for development
* Volume persistence for data
Architecture follows specification exactly:
- Only selected regions are regenerated
- Full image pixels preserved outside mask
- Two-mode operation (cost vs quality)
- Complete edit history and reversibility
- Self-hosted with external AI API calls
All components are fully functional and ready for deployment.