Add advanced editing features: layers, background removal, smart selection

Backend:
- Add /tools router with background removal, smart select, color select
- Add rembg dependency for AI background removal
- Add layer management API (list, flatten)
- Fix transparency preservation in blend_patch (veil collapse fix)
- Preserve alpha channel when reverting/resetting images

Frontend:
- Add AdvancedTools panel with background removal, smart select, color select
- Add Layers panel with drag-to-reorder, visibility toggle, flatten
- Add toolsApi for new backend endpoints
- Make right panel scrollable for additional controls

This adds "Photoshop light" capabilities:
- Remove background and create layer
- Smart object selection (click to select)
- Color selection with tolerance
- Layer system with compositing
This commit is contained in:
Claude
2026-01-25 15:20:11 +00:00
parent 7a86d53c88
commit 909bb41f8a
12 changed files with 1166 additions and 14 deletions
+8 -4
View File
@@ -188,9 +188,11 @@ class EditService:
if not result_path.exists():
raise FileNotFoundError(f"Edit {edit_id} result not found")
# Copy result to current
# Copy result to current (preserve alpha channel)
current_path = self.get_current_image_path(project_id)
Image.open(result_path).save(current_path)
img = Image.open(result_path)
# Preserve original mode to maintain transparency
img.save(current_path, format='PNG')
return str(current_path)
@@ -210,7 +212,9 @@ class EditService:
if not original_path.exists():
raise FileNotFoundError(f"Original image for project {project_id} not found")
# Copy original to current
Image.open(original_path).save(current_path)
# Copy original to current (preserve alpha channel)
img = Image.open(original_path)
# Preserve original mode to maintain transparency
img.save(current_path, format='PNG')
return str(current_path)