Commit graph

611 commits

Author SHA1 Message Date
Siddharth Kumar Sah
af075f19d3 docs: remove Docker Images section from README 2026-04-16 12:52:40 +08:00
Siddharth Kumar Sah
93ce2891cc fix(docker): create /opt/models unconditionally so chown works in CI
When SKIP_MODEL_DOWNLOADS=true the download script never runs, so
/opt/models was never created and the subsequent chown -R ... /opt/models
failed with exit code 1.  mkdir -p it alongside the other required dirs.
2026-04-16 08:55:39 +08:00
Siddharth Kumar Sah
6a3ad0d496 fix(docker): run frontend builder on BUILDPLATFORM to fix esbuild crash under QEMU
esbuild (used by Vite) crashes under QEMU amd64 emulation on Apple Silicon,
the same way the Go runtime did.  Building the frontend on the native platform
is safe because the output (HTML/CSS/JS) contains no architecture-specific code.
2026-04-15 23:20:40 +08:00
Siddharth Kumar Sah
7b4b2569f2 docs: update README with correct Docker Hub/GHCR pull commands and versioning
- Fix docker run commands (was pointing to old stirlingimage/stirling-image)
- Add Docker Images section with all available tags for both registries
- Add GHCR badge alongside Docker Hub badge
- Remove rename banner (rename is complete)
2026-04-15 23:18:11 +08:00
Siddharth Kumar Sah
9cd91edee1 chore(release): 1.15.0
Bump all workspace packages from 1.14.0 to 1.15.0.
2026-04-15 23:17:31 +08:00
Siddharth Kumar Sah
26f5bb8092 fix(docker): proper CGO cross-compilation for caire with multi-arch toolchain
Replace CGO_ENABLED=0 (which fails because gioui.org requires CGO on Linux)
with a proper C cross-compiler approach using Debian multi-arch packages.
Running caire-builder with --platform=\$BUILDPLATFORM avoids QEMU crashes on
Apple Silicon; the C cross-compiler bridges the CGO gap for the target arch.

Also adds SKIP_MODEL_DOWNLOADS=true to the CI docker build job to prevent
HuggingFace CDN 504s in CI (image structure is what matters there).
2026-04-15 23:17:17 +08:00
Siddharth Kumar Sah
57c78e65ba fix(docker): use BUILDPLATFORM for caire to fix amd64 cross-compilation on Apple Silicon
The caire-builder stage now runs the Go toolchain on the native build
platform instead of under QEMU emulation.  For cross-arch builds
(arm64 host → amd64 image) CGO_ENABLED=0 avoids needing a full C
cross-toolchain; the display window is unused in server mode anyway.
The binary is staged to /tmp/caire so the COPY path is stable across
both native and cross-compiled builds.
2026-04-15 23:11:47 +08:00
Siddharth Kumar Sah
251445b092 fix(noise-removal): write denoised output to workspace path and add e2e test 2026-04-15 23:11:40 +08:00
Siddharth Kumar Sah
3c1bf0a77d feat(ai): dual-model face detection with NMS deduplication
Run both short-range and full-range MediaPipe models and merge results,
then apply non-maximum suppression to remove duplicate bounding boxes.
Fixes missed faces in group photos where the single-model loop exited
early after the first positive detection.
2026-04-15 23:11:36 +08:00
Siddharth Kumar Sah
ea98e9b5de feat(watermark): overhaul settings UI with improved controls 2026-04-15 23:11:31 +08:00
Siddharth Kumar Sah
a8cca62336 feat(erase-object): auto-center compare slider at erased region
Track the painted mask centroid and initialise the before/after slider
at that position so the result is immediately visible without manual
dragging.
2026-04-15 23:11:27 +08:00
Siddharth Kumar Sah
dd1e2e5ba5 docs: add restore-photo state-of-the-art redesign spec
Full pipeline redesign spec: SD-inpainting, NAFNet, CT2 colorization,
Real-ESRGAN SR, tiled inference, GPU-first, single best-quality mode.
2026-04-15 22:39:21 +08:00
Siddharth Kumar Sah
0cf7156b7e fix(preview): show image preview instead of 'Conversion complete' for blob URLs
canBrowserPreview() was checking for a file extension in blob: URLs, which
have none (blob:http://localhost:1349/<uuid>). This caused the optimize-for-web
live preview — which stores a blob: URL in processedUrl — to always return false
and show the 'Conversion complete' fallback card instead of the BeforeAfterSlider.

Fix: blob: URLs are always renderable in <img> tags; short-circuit the extension
check with `if (url.startsWith('blob:')) return true` in both tool-page.tsx and
multi-image-viewer.tsx.
2026-04-15 18:52:36 +08:00
Siddharth Kumar Sah
d4ac116c15 chore: remove broken /batch and /pipeline tool stubs
Both routes showed "Tool not found" — the UI was never implemented.
Pipeline functionality already lives at /automate (the Automate page).
Also removed the empty Automation category and unused Workflow/FolderInput
icons from icon-map.ts.
2026-04-15 18:52:36 +08:00
Siddharth Kumar Sah
a4c63855d4 fix(docker): fix TDZ crash, icon bundle bloat, rate-limit on static assets
- Fix "Cannot access 'a' before initialization" TDZ error after login
  caused by manualChunks splitting react-vendor + lucide icons into
  circular ES-module chunks. Removed manualChunks entirely.

- Replace `import * as icons from "lucide-react"` (pulls all ~1000 icons)
  with a targeted icon-map of ~50 icons actually used by tool definitions.
  Reduces shared icons chunk from 745KB to 62KB (132KB→16KB gzip).

- Exclude static files from @fastify/rate-limit via allowList so rapid
  page navigations don't 429 on JS/CSS chunk requests.

- Move Docker auth defaults (AUTH_ENABLED, DEFAULT_USERNAME,
  DEFAULT_PASSWORD) from Dockerfile ENV to entrypoint.sh runtime exports
  to avoid SecretsUsedInArgOrEnv warnings.

- Fix Docker CMD to use pnpm --filter for workspace-scoped tsx binary.

- Set COREPACK_HOME system-wide so non-root user can access pnpm cache.

- Lazy-load all pages in App.tsx and all controls in
  pipeline-step-settings.tsx to keep main bundle under 300KB.
2026-04-15 18:52:36 +08:00
stirling-image
82073bba68
Update README.md
Temporarily use the older docker hub until the new amd64/arm64 docker container is pushed to to the new docker hub
2026-04-15 09:17:07 +08:00
Siddharth Kumar Sah
b7033b3f53 fix(docker): use hf_hub_download for HuggingFace models to fix CDN 504s
urlretrieve against the HuggingFace CDN was consistently returning HTTP
504 in GitHub Actions runners for LaMa, NAFNet, and the OpenCV caffemodel.
The huggingface_hub library has built-in retry logic, resumable downloads,
and better CDN routing than bare urlretrieve.

- download_lama_model: urlretrieve → hf_hub_download (Carve/LaMa-ONNX)
- download_nafnet_model: urlretrieve → hf_hub_download (mikestealth/nafnet-models)
- download_opencv_colorize_models: caffemodel → hf_hub_download (space repo_type)
- _urlretrieve: retry count 3→5, flat 10s delay → exponential backoff (10/20/40/80s)
- Also reverts the SKIP_MODEL_DOWNLOADS=true from CI workflow (wrong approach)
2026-04-14 23:05:09 +08:00
Siddharth Kumar Sah
a8ce0a7559 fix(docker): skip model downloads in CI to prevent HuggingFace CDN 504s
The Docker Build Test was consistently failing because HuggingFace CDN
returns 504 Gateway Timeout when downloading the LaMa ONNX model (~200MB)
from GitHub Actions runners. Model availability is an external dependency,
not something CI can control.

Added SKIP_MODEL_DOWNLOADS build arg (default: false). When set to true,
the download_models.py step is skipped entirely. CI only needs to verify
the image structure builds — Python deps install, Node build runs, app
code is copied — not that every ML model CDN is reachable.

Production builds (docker build without the arg) still download all models
as before.
2026-04-14 23:02:16 +08:00
Siddharth Kumar Sah
fb6cff0fec fix(docker): add retry logic to model downloads for transient 5xx/timeout errors
download_models.py used bare urllib.request.urlretrieve() with no retry
logic. CI hit a HTTP 504 Gateway Timeout mid-build, failing the Docker
Build Test. Added _urlretrieve() wrapper that retries up to 3 times with
a 10s delay on any 5xx or network error. Also adds imports for time and
urllib.error.
2026-04-14 22:49:49 +08:00
Siddharth Kumar Sah
0f156d13a3 fix(tests): prevent SQLITE_BUSY race by running tests in a single fork
vitest was spawning multiple worker processes (one per test file) that
each independently opened the same SQLite database and raced to set
journal_mode = WAL. Adding pool: "forks" with singleFork: true runs all
test files in the same child process, eliminating the concurrent-open
race. The test suite (~830 tests) remains fast enough for CI.
2026-04-14 22:27:32 +08:00
Siddharth Kumar Sah
86ae18b153 fix(tests): update EXIF fixture Software tag to ashim after rename
The test-with-exif.jpg fixture still had "Stirling-Image Test" as its
Software EXIF field. Updated to "ashim Test" to match the assertions in
operations.test.ts that were already updated during the rebrand.
2026-04-14 22:23:46 +08:00
Siddharth Kumar Sah
93c588b239 fix(lint): resolve all biome warnings across API, web, and image-engine
API:
- Replace string concatenation with template literals (batch, pipeline,
  tool-factory, content-aware-resize, passport-photo, remove-background)
- Remove unused imports (teams, color-adjustments, image-enhancement)
- Replace non-null assertions with guard clauses in bg-effects and stitch
- Use optional chaining in docs route

Image-engine:
- Remove unused OutputFormat imports (compress, convert)
- Use local variables instead of reassigning parameters (optimize-for-web, sharpen)

Web:
- Fix useExhaustiveDependencies: remove genuinely redundant deps, add
  biome-ignore comments for intentional patterns (src prop, cleanup fns)
- Replace non-null assertions with null-safe alternatives
- Add accessible titles to inline SVGs (color-settings, image-enhancement-settings)
- Fix noLabelWithoutControl: associate labels via htmlFor/id or use <span>
  (image-to-base64-settings, edit-metadata-settings, qr-generate-settings)
- Replace div[role="button"] with <button> (pdf-to-image-settings)
- Use stable keys instead of array indices (collage-preview, collage-settings)
- Fix noStaticElementInteractions in collage-preview (role="none")
- Remove unused function parameters and imports
2026-04-14 22:15:37 +08:00
Siddharth Kumar Sah
3982ff4136 fix(lint): fix import ordering broken by @stirling-image → @ashim rename
The package scope rename changed the alphabetical position of imports
(@ashim sorts before @dnd-kit; @stirling-image sorted after), causing
biome's organizeImports rule to flag them as unsorted.

- apps/api/src/index.ts: sort registerRestorePhoto import correctly
- apps/web/src/components/tools/pipeline-builder.tsx: sort @ashim/shared import
- apps/web/src/pages/privacy-policy-page.tsx: auto-format
2026-04-14 22:01:04 +08:00
Siddharth Kumar Sah
85b1cfc10a chore: rename Stirling-Image to ashim across entire codebase
Complete rebrand from Stirling-Image to ashim following the project
move to https://github.com/ashim-hq/ashim.

Changes across 117 files:
- Package scope: @stirling-image/* → @ashim/*
- GitHub URLs: stirling-image/stirling-image → ashim-hq/ashim
- Docker Hub: stirlingimage/stirling-image → ashimhq/ashim
- GitHub Pages: stirling-image.github.io → ashim-hq.github.io
- All branding text: "Stirling Image" → "ashim"
- Docker service/volumes/user: stirling → ashim
- Database: stirling.db → ashim.db
- localStorage keys: stirling-token → ashim-token
- Environment variables: STIRLING_GPU → ASHIM_GPU
- Python cache dirs: .cache/stirling-image → .cache/ashim
- SVG filter IDs, test prefixes, and all other references
2026-04-14 20:55:42 +08:00
Siddharth Kumar Sah
da4411330f feat(collage): overhaul collage tool with preview panel and enhanced settings
Apply stash from feat/border-redesign branch. Rewrites collage backend
with improved layout engine and adds CollagePreview results panel for
interactive preview. Updates tool registry to use no-dropzone display
mode with the new preview component.
2026-04-14 20:47:36 +08:00
Siddharth Kumar Sah
20f7671715 chore: add CLAUDE.md to .gitignore to keep it local-only 2026-04-14 20:40:23 +08:00
stirling-image
f00a86aa18 fix(docker): rename duplicate download_codeformer_model function
The ONNX variant shadowed the .pth variant due to identical function
names, so codeformer.pth was never downloaded. Renamed the ONNX
function to download_codeformer_onnx_model so both run.
2026-04-14 18:00:47 +08:00
stirling-image
382e974eed fix(docker): use HuggingFace mirror for colorization caffemodel
The original Berkeley server (eecs.berkeley.edu) is dead, returning
404 after redirect. Switched to a reliable HuggingFace-hosted mirror
of the same 129MB model file.
2026-04-14 17:41:39 +08:00
stirling-image
fce2c64ba2 fix(docker): add User-Agent header to model downloads
The Berkeley colorization server returns 403 for the default
Python-urllib User-Agent. Setting a global opener fixes this
for all model downloads.
2026-04-14 17:26:01 +08:00
stirling-image
fede23e3a6 fix(docker): correct facexlib parsing_parsenet.pth download URL
The model is in the v0.2.2 release, not v0.1.0.
2026-04-14 17:07:23 +08:00
stirling-image
8d8ab4bc45
fix(docker): close remaining airgap gaps for fully offline operation (#70)
Three fixes to ensure zero network access after docker pull:

1. rembg model allowlist: validate model parameter against the 7
   pre-downloaded models, preventing rembg from attempting to download
   unknown models via a raw API call.

2. GFPGAN/CodeFormer auxiliary models: pre-download facexlib's
   detection_Resnet50_Final.pth and parsing_parsenet.pth at build time.
   These were previously downloaded on first use via basicsr. Symlinks
   in /app/gfpgan/weights/ ensure codeformer-pip also finds them.

3. OpenCV colorize models: pre-download the prototxt, caffemodel, and
   pts_in_hull.npy so the lightweight OpenCV colorizer fallback works
   in addition to the primary DDColor method.

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
2026-04-14 16:51:46 +08:00
stirling-image
e3bfa6585a fix(ai): use .tflite URL for blaze_face_short_range model
Google removed the .task bundle from their MediaPipe storage,
causing Docker builds to fail with a 404 during model download.
2026-04-14 16:43:42 +08:00
stirling-image
c6386fa98e fix(optimize-for-web): break infinite preview loop caused by store dependency cycle
The debounce effect depended on currentEntry (from the file store), but
fetchPreview wrote back to the same store entry on completion. This
created a loop: preview completes -> store updates -> new entry ref ->
effect re-fires -> new preview. Fix by reading the file from a ref
instead of reactive state, so the effect only triggers on actual
settings changes (format, quality, dimensions, metadata toggle).
2026-04-14 16:20:25 +08:00
stirling-image
519541867e
fix(ai): support both old and new mediapipe APIs for airgapped Docker (#69)
MediaPipe >= 0.10.30 removed the mp.solutions namespace. This broke
face blur, face enhance, red-eye removal, and photo restoration for
users running newer mediapipe versions (closes #43).

All 5 Python scripts that use mediapipe now try the legacy mp.solutions
API first and fall back to the new mp.tasks API on AttributeError.
Model files (blaze_face_short_range.task, face_landmarker.task) are
pre-downloaded during Docker build into /opt/models/mediapipe/ so the
image works fully airgapped. Local dev auto-downloads to .models/.

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
2026-04-14 16:18:17 +08:00
stirling-image
5be8be3dc3
feat: add Optimize for Web tool (#68)
* feat(image-engine): add OptimizeForWebOptions type

* feat(image-engine): add optimizeForWeb operation

* feat(shared): add optimize-for-web tool definition and i18n

* feat(api): add optimize-for-web route with preview endpoint

* feat(web): add optimize-for-web settings component with live preview

* feat(web): register optimize-for-web in tool registry

* fix(web): align toggle switch translate with codebase pattern

---------

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
2026-04-14 16:16:04 +08:00
stirling-image
c2c104e887 fix(passport-photo): use bg-background for dropdown to match app theme 2026-04-14 16:01:35 +08:00
stirling-image
e7c1efaaf3 feat(passport-photo): true WYSIWYG - zoom and drag affect the download
- Zoom now controls the actual crop: zoom in = tighter crop, zoom out = more body
- Drag adjusts face position within the frame
- Backend receives zoom value and applies the same zoomed crop
- Download produces exactly what the user sees on the canvas
- Zoom range 0.5x-3x (can zoom out to show more body)
- "What you see is what you download" label
2026-04-14 15:58:31 +08:00
stirling-image
74a6d422c2 feat(passport-photo): restore zoom for visual inspection with clear download disclaimer 2026-04-14 15:52:41 +08:00
stirling-image
4000696bc7 fix(passport-photo): make preview WYSIWYG - remove zoom, what you see is what you download
- Removed zoom controls entirely from preview pane
- Canvas always shows exact passport photo output at 1:1
- Drag to adjust position still works for fine-tuning
- Overlay lines use crop coordinates directly instead of zoom-adjusted ones
- Added "what you see is what you download" label with output dimensions
2026-04-14 15:49:42 +08:00
stirling-image
d6498324ca fix(passport-photo): restrict zoom to 1x-3x so preview matches download exactly 2026-04-14 15:45:33 +08:00
stirling-image
6352a5384e
fix(docker): use pnpm exec instead of npx for airgapped environments (#67)
npx attempts to reach the npm registry even when tsx is installed
locally, causing the container to crash in airgapped/offline
environments with ECONNRESET. pnpm exec resolves tsx from local
node_modules only, with no network calls.

Closes #29

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
2026-04-14 15:44:45 +08:00
stirling-image
bb11e086f9 fix(passport-photo): replace circular compliance checks with source photo validation
Old checks validated head height and eye position against the auto-computed
crop, so they always passed. New checks validate the source photo itself:
face centered, head level (eyes same height), looking straight (nose between
eyes), and face size (large enough for quality crop). Adds detail text on
failed checks and updates the canvas overlay to show eye-level and center
indicators instead of the old crown/chin/eye lines.
2026-04-14 15:41:31 +08:00
stirling-image
dd51175f16 feat(passport-photo): add custom dimensions, DPI control, fix crop mismatch
- Added "Custom Dimensions" option in country dropdown with width/height inputs
- Added DPI control (72-600, default 300) for all specs
- Backend now uses actual bg-removed image dimensions for crop computation,
  scaling landmark coordinates when dimensions differ from the original
- Dropdown background uses explicit bg-white/dark:bg-zinc-900 classes
- Backend supports customWidthMm, customHeightMm, and dpi in generate request
2026-04-14 15:28:21 +08:00
stirling-image
f6cc30e79c fix(passport-photo): fix preview-download mismatch, dropdown bg, scroll hint
- Backend now pads the image with background color when crop region extends
  beyond image bounds, instead of clamping (which cut off heads)
- Dropdown uses explicit bg-white/dark:bg-zinc-900 instead of CSS variable
  that was transparent on some themes
- Added "Scroll to zoom" hint on the right pane canvas
- Fixed file size compression loop to use padded source image
2026-04-14 15:18:36 +08:00
stirling-image
e17d5d08cb fix(passport-photo): fix dropdown overlap, add common bg colors, fix zoom behavior
- Country dropdown now uses position:fixed with z-index:9999 to render above all siblings
- Added 5 common passport background color presets (white, off-white, light gray, light blue, red)
- Zoom now crops into the image center rather than scaling the canvas element
- Compliance overlay lines are zoom-aware
2026-04-14 13:04:35 +08:00
stirling-image
831ef3f2de refactor(passport-photo): rebuild UI for online applications with file size control 2026-04-14 12:55:37 +08:00
stirling-image
3b8cec36e4 Merge branch 'feat/stitch-redesign'
# Conflicts:
#	packages/shared/src/i18n/en.ts
#	pnpm-lock.yaml
2026-04-14 12:35:34 +08:00
stirling-image
1dd87f11d6 fix(passport-photo): support both old and new mediapipe APIs for face landmarks
- Old API (mp.solutions.face_mesh) for Docker with mediapipe < 0.10.30
- New API (mp.tasks.vision.FaceLandmarker) for newer mediapipe >= 0.10.30
- Auto-downloads face_landmarker.task model on first use with new API
- Extracted shared landmark index constants and key point extraction
2026-04-14 12:21:00 +08:00
stirling-image
b2489b0fb6
feat(image-to-base64): progress bar, synced navigation, batch download buttons (#66)
- Process files one at a time for real per-file progress bar
- Sync right panel with left panel file navigation (arrows work)
- Show image preview before conversion
- Add "Download All as JSON" and "Download All as Text" batch buttons
- Unify batch action button styles

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
2026-04-14 12:19:20 +08:00
stirling-image
c09c1be4d2 fix(passport-photo): fix dropdown overlap, add zoom controls to preview
- Add z-30 to country dropdown container to prevent overlap with settings below
- Add mouse wheel zoom on preview canvas (0.5x to 3x)
- Add zoom in/out buttons and reset with percentage display
- Update hint text to "Drag / Scroll to zoom"
2026-04-14 11:55:04 +08:00