Commit Graph
170 Commits
Author SHA1 Message Date
Claude 3746c02d44 Add SAM click-to-select with brush refinement in AI Edit tool
Backend:
- sam_service.py: auto-downloads SAM ViT-B (~375 MB) on first use with
  progress tracking; loads model to CUDA/MPS/CPU; predict_points() takes
  multi-point prompts (include/exclude labels) and returns best mask
- POST /api/segment/point: SAM point-prompt endpoint; returns mask PNG
- GET  /api/segment/install-status: poll download progress
- POST /api/segment/install: explicit trigger (also auto on first click)
- main.py: pre-download SAM on startup alongside NCNN

Frontend (ai_edit.js):
- Click mode (default): click object → SAM generates mask instantly
  Alt+click → subtract (deselect over-selected area)
  Multiple clicks accumulate for multi-object or refinement
- Brush + / Brush − modes: paint to add or erase from SAM mask by hand
- If SAM model is still downloading on first click: inline progress bar,
  user retries the click when done
- Unified action bar: Erase | Replace (inline prompt) | Upscale | Expand | Clear
- All modes share the same mask canvas; SAM and brush are fully composited

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-10 18:18:33 +00:00
Claude 1132656370 Replace scattered AI tools with single unified AI Edit tool
Before: 4 separate tools (ai_inpaint, ai_lama_erase, ai_smart_inpaint,
ai_replace_selection) with no clear relationship, buried in toolbar.

After: one "AI Edit" brush tool. Paint mask → floating action bar appears:
  Erase    — LaMa removes masked content, no prompt needed
  Replace  — inline prompt reveals in-place ("make her smile" / "replace
             with a wolf") → calls /api/inpaint/remote
  Upscale  — delegates to existing upscale module
  Expand   — delegates to existing outpaint module
  Clear    — wipe mask and start over

Brush size controlled by tool attributes (5–200px).
Red overlay gives immediate visual feedback while painting.
Floating panel appears as soon as first brush stroke is made.

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-10 16:42:10 +00:00
Outis a187b8e0f2 Merge pull request #45 from outis1one/claude/awesome-bohr-mks3co
Skip NCNN install on headless/no-Vulkan machines
2026-06-10 12:05:42 -04:00
Claude 717f482987 Skip NCNN install on headless/no-Vulkan machines
- Add _vulkan_available(): checks /dev/dri/renderD* on Linux, assumes
  true on macOS/Windows; set REALESRGAN_NCNN=force to override
- Add _test_ncnn_binary(): test-runs the binary after install and checks
  stderr for "no vulkan" — marks skipped if Vulkan init fails at runtime
- ensure_ncnn_installed() now returns early with state=skipped when no
  Vulkan detected, avoiding a wasted ~30MB download on CPU-only servers
- Recommend PyTorch CPU when available on headless (AI quality, slow but
  works); Lanczos as final fallback
- Frontend: handle state=skipped immediately (no polling needed), show
  brief informational toast; show "Headless server" note in dialog

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-10 00:50:09 +00:00
Outis 3085e5688b Merge pull request #44 from outis1one/claude/awesome-bohr-mks3co
Claude/awesome bohr mks3co
2026-06-09 14:39:48 -04:00
Claude ed2a0d7f0c Auto-install Real-ESRGAN NCNN Vulkan binary on first use
- upscale.py: add InstallStatus dataclass + ensure_ncnn_installed() async
  function that downloads and extracts the NCNN binary for the current
  platform (Linux/macOS/Windows), tracks progress (0-100%), and busts the
  caps cache when done
- main.py: trigger ensure_ncnn_installed() as a background task on app
  startup when no AI upscaler is detected
- print_tools.py: /upscale/available triggers install task when no AI
  upscaler found; new GET /upscale/install-status endpoint for polling
- upscale.js: if no AI upscaler on open, poll install-status showing a
  progress bar notification, then refresh caps and proceed when done

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 18:38:45 +00:00
Claude cea9ee9d6c Smart upscale: auto-detect hardware and pick best Real-ESRGAN path
Detection priority (probed once, cached):
  1. Real-ESRGAN PyTorch + CUDA GPU   → fastest, best quality
  2. Real-ESRGAN PyTorch + Apple MPS  → fast on Apple Silicon
  3. Real-ESRGAN NCNN Vulkan binary   → fast on any GPU via Vulkan (no CUDA needed)
  4. Real-ESRGAN PyTorch CPU          → works, slow (warned in UI)
  5. Lanczos                          → always available, instant fallback

Backend:
- services/upscale.py: full capability probe (probe_upscale_capabilities),
  implementations for PyTorch (CUDA/MPS/CPU auto-device) and NCNN binary,
  upscale_sync() resolves method with fallback chain,
  async upscale_image() runs in thread pool
- print_tools.py: /api/print/upscale uses new service; method="auto" by default;
  GET /api/print/upscale/available returns full capability map with device info
  and recommended_label; POST /api/print/upscale/refresh-caps busts cache
  without restart (useful after installing NCNN binary into container)

Frontend:
- upscale.js: fetches capability map on first open; builds method selector showing
  only available options; labels recommended method with ★; shows device info
  (CUDA/MPS/CPU/NCNN) in dialog; maps display label back to method key on submit;
  shows actual method used in success toast and undo history entry

Scripts:
- scripts/download_realesrgan.py: downloads NCNN Vulkan binary for current platform
  (Linux/macOS/Windows) to /app/data/models/realesrgan/; makes executable;
  run inside container or locally

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 18:32:32 +00:00
Claude 40396b72a0 Add Fit to Frame and Upscale (print tools)
Backend — new /api/print/* router:
- POST /api/print/frame-fit: fit image to 4x6/5x7/8x10/11x14/16x20/20x24/24x36
  and square sizes (4x4/8x8/12x12) at configurable DPI.
  Three modes:
    crop   — center-crop to aspect ratio, Lanczos scale to print res (no AI)
    extend — scale to fill one dimension, AI-inpaint the gap; mirror-fill fallback
    smart  — auto: extend if gap < 15% of frame dimension, else crop
  Auto-detects orientation from image shape; respects explicit portrait/landscape.
- POST /api/print/upscale: Lanczos scale (always) or Real-ESRGAN (if installed)
- GET  /api/print/frame-sizes: frame catalogue with pixel dimensions at 300dpi
- GET  /api/print/upscale/available: reports whether Real-ESRGAN is installed

Frontend:
- modules/image/frame_fit.js: dialog with frame size, orientation, mode, DPI,
  optional extend prompt; shows current image size; result as new layer option
- modules/image/upscale.js: dialog with scale factor (1.5–4×), method selector
  (auto-hides AI option if Real-ESRGAN not available); result as new layer option
- config-menu.js: Fit to Frame... and Upscale... added under Image menu

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 18:21:22 +00:00
Claude d01c11f948 Add per-operation AI provider routing
Each operation (inpaint, txt2img, img2img, outpaint) can now use a different
provider. Resolution order: per-op override → global AI_PROVIDER default.

Example: txt2img→openai, inpaint→invokeai, everything else→invokeai default.

Backend:
- config.py: add AI_PROVIDER_INPAINT / TXT2IMG / IMG2IMG / OUTPAINT settings
- remote_provider.py: get_remote_provider(operation) resolves override then default;
  _build_provider() extracted as shared factory; _OP_FIELD maps op→setting name
- ai_tools.py: each endpoint passes its operation to _require_remote();
  GET /api/config runs per-op health checks concurrently, returns operations map
  and overrides; POST /api/config accepts and applies per-op override fields

Frontend:
- ai_provider_settings.js: four new selects (inpaint/txt2img/img2img/outpaint);
  persists to localStorage and sends per-op fields to POST /api/config
- provider-badge.js: shows override summary (e.g. "invokeai · txt2img→openai")
  and per-op health in tooltip
- .env.example: document per-op override env vars with examples

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 18:14:12 +00:00
Claude b2a12c356f Add generative panels, provider settings UI, and credits
Frontend:
- tools/ai_replace_selection.js: use any selection → remote inpaint with prompt
- modules/generate/text_to_image.js: Text → Image dialog (new layer or replace canvas)
- modules/generate/outpaint.js: Expand Canvas in any direction via remote provider
- modules/tools/ai_provider_settings.js: in-app provider config (OpenAI / InvokeAI /
  ComfyUI / Replicate); persists to localStorage, pushes to POST /api/config at runtime
- config.js: register ai_replace_selection tool
- config-menu.js: add Generate menu (Text→Image, Outpaint); AI Provider Settings under Tools
- modules/help/about.js: updated credits (LaMa, rembg, SAM, InvokeAI, ComfyUI, OpenAI)
- api/capabilities.js: add refreshCapabilities() for post-save cache invalidation

Backend:
- routers/ai_tools.py: POST /api/config — apply provider settings at runtime
  without restart (session-scoped, non-persistent; .env for permanence)

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 17:54:44 +00:00
Claude 27261c4ef4 Add LaMa magic eraser, remote provider abstraction, and AI tool infrastructure
Backend:
- requirements.txt: add simple-lama-inpainting, rembg[gpu]; upgrade opencv to 4.10+
- app/config.py: add InvokeAI (url, model) and ComfyUI (url, model) settings; OPENAI_MODEL
- app/services/local_inpaint.py: LaMa, OpenCV, rembg wrappers (auto GPU/CPU)
- app/services/remote_provider.py: abstract RemoteAIProvider + OpenAI, InvokeAI, ComfyUI drivers
- app/routers/ai_tools.py: new /api/* endpoints — /erase, /inpaint/lama, /inpaint/fast,
  /background/remove, /inpaint/remote, /generate/txt2img, /generate/img2img,
  /generate/outpaint, GET /config (capability flags)
- app/main.py: register ai_tools router

Frontend:
- services/api.js: add erase(), textToImage(), imageToImage(), remoteInpaint(), getConfig()
- api/capabilities.js: lazy-fetch /api/config singleton; hasRemote() helper
- tools/ai_lama_erase.js: brush-paint mask → LaMa erase → apply to layer
- tools/ai_smart_inpaint.js: brush mask + dialog (Fast/Quality mode + prompt) → inpaint
- core/components/provider-badge.js: shows active provider + health in toolbar
- config.js: register ai_lama_erase and ai_smart_inpaint tools
- main.js: mount provider badge on load
- .env.example: document InvokeAI, ComfyUI, OpenAI provider settings

https://claude.ai/code/session_01B58MaJCU1R6KwBDJCp8AfN
2026-06-09 17:42:48 +00:00
Outis d5898dd054 Merge pull request #43 from outis1one/claude/fix-ai-paint-tool-yz6q8
Fix U2Net, alertify dialogs, and improve AI Paint workflow
2026-01-28 08:38:06 -05:00
Claude 871fc696f5 Fix U2Net, alertify dialogs, and improve AI Paint workflow
- Switch U2Net from onnxruntime to OpenCV DNN to avoid
  "cannot enable executable stack" error in Docker
- Add alertify dialog styling to fix white text on white
  background issue in popups
- Add offerFloatSelection() to AI Paint that prompts user
  after selection to move/scale it (Canva-like workflow)
- Auto-switch to Select tool after floating selection

https://claude.ai/code/session_01CLedz6CanT9t46KBvng3vz
2026-01-28 13:23:49 +00:00
Outis 9a305126ed Merge pull request #42 from outis1one/claude/fix-ai-paint-tool-yz6q8
Fix AI Paint tool processing state and use full U2net model
2026-01-27 22:17:29 -05:00
Claude ed491ab9ba Fix AI Paint tool processing state and use full U2net model
- Fix brush_select isProcessing flag not resetting after first use
  (reset in on_leave() when switching tools)
- Add onnxruntime dependency for U2net background removal
- Use full U2net model (176MB) instead of lightweight for better quality

https://claude.ai/code/session_01CLedz6CanT9t46KBvng3vz
2026-01-28 03:05:23 +00:00
Outis 517024ba6f Merge pull request #41 from outis1one/claude/fix-ai-paint-tool-yz6q8
Fix selection tools, add float selection, aspect ratio lock, U2net au…
2026-01-27 18:07:46 -05:00
Claude e26c914483 Fix selection tools, add float selection, aspect ratio lock, U2net auto-download
- Fix brush_select and smart_select mask scaling to match layer dimensions
- Add "Float Selection" feature to Select tool - when switching to Select
  with an active AI selection, offers to copy it to a movable layer
- Add aspect ratio lock toggle (🔗 button) in layer details panel
- When locked, changing width auto-updates height and vice versa
- Add U2net model auto-download - will download lightweight u2netp.onnx (~4MB)
  automatically if no model found
- Improve error messages for background removal
- Register on_activate for select tool in config

Workflow: Select object with AI tool → Click Select tool → "Float" selection
→ Move/scale the floated layer freely

https://claude.ai/code/session_01CLedz6CanT9t46KBvng3vz
2026-01-27 22:59:22 +00:00
Outis 051f581573 Merge pull request #40 from outis1one/claude/fix-ai-paint-tool-yz6q8
Fix AI tools and My Library, add U2net background removal
2026-01-27 17:32:08 -05:00
Claude 549a1a4e82 Fix AI tools and My Library, add U2net background removal
- Fix My Library: Add CSS styling for library browser, items now visible
- Integrate My Library into Shapes tool with tabbed interface
- Improve AI Inpaint: Add transform mode for scaling/sizing selections
- Add helpful guidance explaining inpaint vs transform modes
- Add U2net as alternative background removal (avoids rembg issues)
- Create U2net model definition and download script
- Improve Caddyfile with multiple options and troubleshooting guide

Note: Brush Select (AI Paint) tool was already implemented and working.

https://claude.ai/code/session_01CLedz6CanT9t46KBvng3vz
2026-01-27 22:29:35 +00:00
Outis 17806a0403 Merge pull request #39 from outis1one/claude/fix-editmaskwithai-build-q8A5W
Disable rembg to fix build - numpy version conflict
2026-01-27 12:59:22 -05:00
Claude 41598722f1 Disable rembg to fix build - numpy version conflict
rembg>=2.0.70 has an incompatible dependency chain:
- rembg requires scikit-image>=0.26.0
- scikit-image 0.26+ pulls in numpy 2.x
- opencv-python-headless 4.9.0.80 was compiled for numpy 1.x
- Runtime crash: "numpy.core.multiarray failed to import"

Fix: Revert to known-working numpy<2 stack:
- numpy<2.0.0 (explicit pin)
- Pillow 10.x (compatible with numpy 1.x)
- torch 2.1.2 / torchvision 0.16.2 (numpy 1.x compatible)
- Remove rembg and onnxruntime

Background removal endpoints will return 500 with "rembg not installed"
message (code already handles this gracefully).

To re-enable rembg in future: update opencv-python-headless to 4.10+
which supports numpy 2.x.

https://claude.ai/code/session_01MYpjNQXD1fZE4gCweGU4QQ
2026-01-27 17:55:54 +00:00
Outis 79d601da35 Merge pull request #38 from outis1one/claude/fix-editmaskwithai-build-q8A5W
Claude/fix editmaskwithai build q8 a5 w
2026-01-27 12:39:32 -05:00
Claude 62ad349a83 Update torch/torchvision for numpy 2.x compatibility
scikit-image 0.26+ (required by rembg) needs numpy 2.x compatible
packages. Updated torch from 2.1.2 to 2.4+ and torchvision from
0.16.2 to 0.19+ which officially support numpy 2.x.

https://claude.ai/code/session_01MYpjNQXD1fZE4gCweGU4QQ
2026-01-27 17:37:07 +00:00
Claude b4fae0909c Remove pinned numpy and scikit-image to fix rembg dependency resolution
rembg>=2.0.70 requires scikit-image>=0.26.0, which conflicted with
the pinned scikit-image==0.22.0. Instead of pinning specific versions,
let pip resolve compatible versions automatically based on rembg's
requirements.

Also removed numpy pin as it may conflict with torch/rembg dependencies
- pip will select a compatible version.

https://claude.ai/code/session_01MYpjNQXD1fZE4gCweGU4QQ
2026-01-27 17:36:30 +00:00
Outis d5f7c4f49d Merge pull request #37 from outis1one/claude/fix-editmaskwithai-build-q8A5W
Fix Pillow version to match rembg>=2.0.70 requirements
2026-01-27 12:20:53 -05:00
Claude e902ceb0a8 Fix Pillow version to match rembg>=2.0.70 requirements
rembg 2.0.70+ requires Pillow>=12.1.0,<13.0.0 which conflicted with
the pinned Pillow==10.2.0. Updated to use the version range that
satisfies rembg while remaining compatible with scikit-image and
torchvision (both have no upper bound on Pillow).

https://claude.ai/code/session_01MYpjNQXD1fZE4gCweGU4QQ
2026-01-27 17:19:06 +00:00
Outis f2f19ef683 Update numpy version to 2.3.0 2026-01-27 10:03:06 -05:00
Outis bb4099f7a0 Merge pull request #36 from outis1one/claude/migrate-to-minipaint-eYKWf
Remove execstack from Dockerfile (not available in Debian trixie)
2026-01-27 09:59:17 -05:00
Claude bca0eeb259 Remove execstack from Dockerfile (not available in Debian trixie) 2026-01-27 14:57:20 +00:00
Outis 590398a4af Merge pull request #35 from outis1one/claude/migrate-to-minipaint-eYKWf
Upgrade rembg to use BiRefNet model (state-of-the-art)
2026-01-27 09:53:54 -05:00
Outis 699ec2d670 Merge branch 'main' into claude/migrate-to-minipaint-eYKWf 2026-01-27 09:53:35 -05:00
Claude 2ab9ed7559 Upgrade rembg to use BiRefNet model (state-of-the-art)
- Use onnxruntime>=1.17.0 (fixed executable stack issues, no execstack needed)
- Use rembg>=2.0.70 with BiRefNet model support
- Update all remove-background endpoints to use birefnet-general model
- BiRefNet provides better edge detection and matting quality than u2net
- Falls back to default model if BiRefNet unavailable
2026-01-27 14:34:28 +00:00
Outis ac702bde0a Merge pull request #34 from outis1one/claude/migrate-to-minipaint-eYKWf
Fix rembg/onnxruntime Docker build issue
2026-01-27 09:14:23 -05:00
Outis 6bfd3766c8 Merge branch 'main' into claude/migrate-to-minipaint-eYKWf 2026-01-27 09:13:18 -05:00
Claude 44bc5ed2f5 Fix rembg/onnxruntime Docker build issue
- Use onnxruntime 1.14.1 (older version without executable stack requirement)
- Make rembg pre-download optional (won't fail build if onnxruntime has issues)
- Remove Background will be disabled if rembg can't load
2026-01-27 14:08:16 +00:00
Outis 892d901394 Merge pull request #33 from outis1one/claude/migrate-to-minipaint-eYKWf
Claude/migrate to minipaint e yk wf
2026-01-27 08:29:50 -05:00
Claude 8087d6967a Add My Library for reusable assets (clip art, templates)
- Save layer or selection to personal library
- Browse library with category grouping and thumbnails
- Insert assets as new layers (double-click or Insert button)
- Delete unwanted assets
- Export library to JSON for backup
- Import library from JSON backup
- Assets stored in browser IndexedDB (persistent)
- Categories: General, Shapes, Borders, Icons, Templates, etc.
2026-01-27 13:15:58 +00:00
Claude 4d4947df13 Add selection-based effects (invert, adjust, greyscale)
- New Image > Selection Effects submenu
- Invert Selection: Invert colors only within selected area
- Adjust Selection: Brightness/contrast/gamma on selection only
- Greyscale Selection: Convert just the selected area to greyscale
- All effects work with any selection tool (Smart Select, Brush Select, etc.)
- Useful for CNC depth maps where specific objects need different treatments
2026-01-27 13:09:06 +00:00
Claude 1be13d3620 Add layer scaling, greyscale effect, and context menu
- Fix onnxruntime version (1.15.1) to avoid executable stack issue
- Add Layer Scale module (Layer > Scale Layer or 'S' button)
- Add Greyscale effect with multiple methods (luminosity, average, etc.)
- Add right-click context menu on layers with common operations
- Add Scale button to layers panel toolbar
2026-01-27 12:51:11 +00:00
Outis ed1c56b89e Merge pull request #32 from outis1one/claude/fix-rembg-docker-build-CWGXj
Fix onnxruntime executable stack error in Docker build
2026-01-26 23:50:39 -05:00
Claude a1dd81b981 Fix onnxruntime executable stack error in Docker build
The onnxruntime library requires an executable stack which is blocked
by security restrictions in Docker containers. This adds execstack tool
and uses it to clear the executable stack flag after pip install.

https://claude.ai/code/session_01AGoPJaXqdJnnuxtmSv6NLR
2026-01-27 04:49:32 +00:00
Outis dd4cd99e79 Merge pull request #31 from outis1one/claude/migrate-to-minipaint-eYKWf
Claude/migrate to minipaint e yk wf
2026-01-26 23:28:49 -05:00
Claude d9fea955fc Fix rembg error handling in Dockerfile 2026-01-27 04:27:53 +00:00
Claude a9a2b7bf04 Add Canva-style Brush Select tool with SAM AI
- New tool: Paint/brush over objects to select them
- AI (SAM) detects actual object boundaries from brush strokes
- Collects sample points along brush path, sends to SAM
- Combines multiple masks for multi-object selection
- Shift+brush to add to existing selection
- Full cut/copy/delete support with mask-shaped results
- Visual feedback: brush stroke preview, sample points, marching ants
2026-01-27 04:22:44 +00:00
Outis 1130680cfe Merge pull request #30 from outis1one/claude/migrate-to-minipaint-eYKWf
Fix selection tools and improve UI/UX
2026-01-26 22:33:00 -05:00
Claude d2f7b69dc7 Fix selection tools and improve UI/UX
- Fix cut/copy to preserve mask shape with transparency
- Add missing CSS icons for magic_wand, lasso, ellipse_select tools
- Fix toast messages styling (visible on dark theme)
- Update AI Inpaint to work with all selection tools
- Change tab title to +miniPaint
- Add DNS config to docker-compose for external API access
2026-01-27 03:09:55 +00:00
Outis a3f559bb40 Merge pull request #29 from outis1one/claude/migrate-to-minipaint-eYKWf
Add Remove Background feature using AI (rembg)
2026-01-26 19:54:01 -05:00
Claude 22d9f767a8 Add Remove Background feature using AI (rembg)
Frontend:
- Added "Remove Background (AI)" to Image menu
- Created remove_background.js module with dialog options
- Added removeBackground method to API service

Backend:
- Added /tools/remove-background-base64 endpoint for miniPaint frontend
- Uses rembg library for AI-powered background removal

Features:
- Automatically detects main subject and removes background
- Option to create as new layer or replace current
- Enables transparency mode after removal
- Works with any image layer
2026-01-27 00:47:22 +00:00
Outis d27610eaf1 Merge pull request #28 from outis1one/claude/migrate-to-minipaint-eYKWf
Add selection tools: Magic Wand, Lasso, Ellipse Select
2026-01-26 19:42:27 -05:00
Claude f650ec3019 Add selection tools: Magic Wand, Lasso, Ellipse Select
New Selection Tools:
- Magic Wand: Click to select by color similarity (like GIMP)
  - Configurable tolerance (0-100%)
  - Contiguous or global mode
  - Shift+Click to add to selection

- Lasso: Freehand selection by drawing
  - Draw around area to select
  - Shift+Draw to add to selection

- Ellipse Select: Draw elliptical/circular selections
  - Drag to create ellipse
  - Shift+Drag for perfect circle
  - Alt+Drag to draw from center

Smart Select Improvements:
- Fixed copy/cut to layer errors
- Added Shift+Click for multi-select (additive selection)
- All operations use proper layer action system

All selection tools support:
- Ctrl+C: Copy selection to new layer
- Ctrl+X: Cut selection to new layer
- Delete: Delete selected area
- Escape: Clear selection
- Marching ants animation on selection edge
2026-01-27 00:39:40 +00:00