Commit Graph
1281 Commits
Author SHA1 Message Date
SnapOtter f1a4c94375 feat: replace AI matting with chroma-based checkerboard detection
The transparency-fixer now directly detects the baked-in checkerboard
pattern using per-pixel chroma analysis instead of BiRefNet AI matting.
Achromatic pixels in the gray range are classified as background
(transparent), chromatic pixels as foreground (opaque), with smooth
transitions at anti-aliased edges.

- No longer requires Python sidecar or background-removal bundle
- Watermark removal uses Sharp median(5) filter pre-processing
- Moved tool from "ai" to "utilities" category
- Removed from PYTHON_SIDECAR_TOOLS and background-removal enablesTools
- Near-instant processing (pure Sharp, no model inference)
2026-05-13 17:16:02 +08:00
SnapOtter 443e9a4ffa fix: replace broken LaMa watermark detection with median filter approach
The luminance anomaly detection + LaMa inpainting approach failed because
watermark signal on the matted foreground was too weak (10-15 units vs
threshold of 25). Median filter with kernel=5 effectively removes
semi-transparent watermark text while preserving the stamp structure.

Pipeline is now: median filter (if toggle on) -> BiRefNet matting -> defringe.
No longer requires object-eraser-colorize bundle for watermark removal.
2026-05-13 17:08:15 +08:00
SnapOtter 132aa2cd0f test(e2e): update restore-photo tests for mode removal and colorize strength 2026-05-13 17:07:21 +08:00
SnapOtter 6f30dbc09e feat(web): remove mode selector, add colorize strength slider 2026-05-13 17:06:45 +08:00
SnapOtter 1b81fc61f1 fix(ai): face guard for small faces, remove mode system, add colorizeStrength 2026-05-13 17:03:57 +08:00
SnapOtter e429f6fd6a fix(ai): tiled LaMa inpainting at native resolution 2026-05-13 17:02:37 +08:00
SnapOtter a6c5016c35 fix(ai): rewrite scratch detection with 8-angle Otsu and component filtering 2026-05-13 17:01:50 +08:00
SnapOtter 79cb570a3a refactor(api): remove mode, add colorizeStrength, lower denoise default to 25 2026-05-13 16:59:13 +08:00
SnapOtter 693b441aa0 refactor(ai): remove mode, add colorizeStrength to restore options 2026-05-13 16:55:38 +08:00
SnapOtter dd6ea16dd4 docs: add restore-photo quality overhaul implementation plan
8 tasks covering: TS bridge update, API schema changes, Python scratch
detection rewrite, tiled LaMa inpainting, face enhancement guard,
frontend settings, E2E tests, and diagnostic verification.
2026-05-13 16:52:21 +08:00
SnapOtter 32ff0f6217 docs: add restore-photo quality overhaul design spec
Evidence-based spec informed by diagnostic testing on 4 sample images.
Addresses catastrophic scratch over-detection (up to 68.7% false
coverage on small images), LaMa 512x512 resolution loss, CodeFormer
over-smoothing on small faces, and excessive NLMeans defaults.
2026-05-13 16:41:30 +08:00
SnapOtter 54f3867086 feat: add Remove Watermark toggle UI with feature gating and e2e tests 2026-05-13 16:20:40 +08:00
SnapOtter 182841b853 feat: add watermark detection and LaMa inpainting to transparency-fixer pipeline 2026-05-13 16:18:28 +08:00
SnapOtter 1581fa933f feat: add i18n strings for transparency-fixer watermark removal 2026-05-13 16:15:13 +08:00
SnapOtter e1ca06cd95 fix: update unit tests for DecodedPreview return type and outpaint tier arg 2026-05-13 15:53:09 +08:00
SnapOtter c3dc98834d feat: add quality tier selector to AI canvas expand UI 2026-05-13 15:47:58 +08:00
SnapOtter aae1a26efc test: add e2e tests for AI canvas expand quality tier UI 2026-05-13 15:47:39 +08:00
SnapOtter ae7c620c92 test: add tier parameter validation tests for AI canvas expand 2026-05-13 15:47:28 +08:00
SnapOtter 2743d9df22 feat(api): add quality tier to ai-canvas-expand schema and routes
Add tier enum (fast/balanced/high) with balanced default to the Zod
settings schema. Pass tier through to outpaint options in both the HTTP
route and the pipeline/batch registry. Fix log message to say
"Starting AI canvas expand" and include tier in structured log fields.
2026-05-13 15:46:08 +08:00
SnapOtter cc2c182e67 feat(ai): pass quality tier through Node outpaint bridge
Add optional tier field to OutpaintOptions interface and forward it as
the 7th argument to the Python outpaint script, defaulting to balanced.
2026-05-13 15:46:02 +08:00
SnapOtter 55e544317c feat(ai): parameterize outpaint pipeline with quality tier support
Add TIER_PARAMS dict with fast/balanced/high presets controlling band
size, mask dilation, seam strip width, and Telea pre-inpainting. Parse
tier from sys.argv[7] with balanced fallback. Conditional Telea and
seam refinement steps skip cleanly for fast tier. Progressive outpaint
now accepts band_size and progress bounds for tier-appropriate scaling.
2026-05-13 15:45:19 +08:00
SnapOtter 3760885342 fix: restore-photo colorize hang and AVIF decode failures
- Fix dispatcher pipe deadlock: drain stdout pipe in a background thread
  to prevent blocking when ONNX runtime output exceeds 64KB pipe buffer
- Add 5-minute SSE stall timeout so the UI shows an error instead of
  hanging forever when async AI processing stalls
- Guard CPU colorization: skip for images >2MP on CPU and when DDColor
  model is not installed, with clear user-facing messages
- Add AVIF decode fallback via ImageMagick for bitstream variants that
  Sharp's bundled libheif cannot decode (affects all tools)
2026-05-13 15:42:24 +08:00
SnapOtter 917c1ff773 fix: EXR/HDR decode failures and batch network timeout
EXR: add ffmpeg fallback when ImageMagick lacks the OpenEXR delegate
(common on macOS Homebrew installs). HDR: force 8-bit depth output to
prevent CLAHE crash (hist_local requires VIPS_FORMAT_UCHAR). Batch:
disable socket timeout and increase server requestTimeout to 30 min
so large AI batches don't get killed by Node.js defaults.
2026-05-13 14:19:51 +08:00
SnapOtter 648c8c12f5 fix: convert input buffer to PNG before passing to face landmarks Python sidecar
AVIF (and other Sharp-native formats) were written as raw bytes to a
.png temp file, causing PIL to fail with "cannot identify image file".
Every other AI module wrapper already converts via sharp().png().toBuffer()
before writing; face-landmarks was the only one that skipped this step.
2026-05-13 14:18:49 +08:00
SnapOtter 0b3f46407a fix: convert HDR/EXR to 8-bit before CLAHE in image enhancement
HDR and EXR files decoded by ImageMagick can produce 16-bit PNG buffers.
Sharp's CLAHE operation (hist_local) requires VIPS_FORMAT_UCHAR (8-bit).
Check the buffer depth and convert to 8-bit sRGB before processing.
2026-05-13 14:16:18 +08:00
SnapOtter ec4c97cc59 test: e2e tests for multi-file eraser stroke persistence and Erase All 2026-05-13 13:45:39 +08:00
SnapOtter 10a6c72f9e test: add sequential multi-file erase-object integration test 2026-05-13 13:45:08 +08:00
SnapOtter b413ace031 feat: multi-file eraser with sequential processing and Erase All button 2026-05-13 13:43:13 +08:00
SnapOtter a5a46a5ece feat: wire maskedFileCount through eraser props 2026-05-13 13:38:15 +08:00
SnapOtter bfffe8a6bd fix: gate eraser canvas on previewLoading for exotic formats 2026-05-13 13:37:57 +08:00
SnapOtter 09d494d87d feat: store eraser strokes per-image for multi-file support 2026-05-13 13:32:44 +08:00
SnapOtter 3497cd0c9a fix: show checkerboard pattern for transparent background in remove-bg tool 2026-05-13 12:10:01 +08:00
SnapOtter 6a90f29960 fix: add exotic format decoding to OCR tool
OCR was the only AI tool missing HEIC/HEIF and CLI-decoded format
support (RAW, PSD, TGA, EXR, HDR, BMP, ICO, JXL, JP2, EPS, etc.).
2026-05-13 11:50:28 +08:00
SnapOtter f46219c730 fix: prevent tall images from being cropped in live-preview wrapper
The wrapper used inline-block for tools without overlay children (e.g.
border). CSS maxHeight: 100% on the img inside an inline-block parent
without explicit height does not resolve, so tall images rendered at
natural height and got clipped by overflow: hidden. Unify both code
paths to always use inline-flex + column, where the flex item properly
shrinks within the container's maxHeight constraint.
2026-05-13 11:45:49 +08:00
SnapOtter 882ca2caf4 fix: force PNG output for TIFF when alpha is required
Sharp's TIFF encoder silently strips the alpha channel, flattening
transparency against black. This caused border (corner radius, shadow),
beautify, and replace-color tools to produce wrong output for TIFF
inputs when the operation needs transparency. Remove TIFF from
ALPHA_FORMATS so these tools fall back to PNG output.
2026-05-13 11:37:45 +08:00
SnapOtter d22bebb8ad fix: gracefully handle mixed formats in find-duplicates and fix network errors
The find-duplicates tool failed entirely when any uploaded file couldn't
be processed, returning "Duplicate detection failed" or a format-specific
error that aborted the whole batch. With mixed-format uploads (77 files),
this made the tool unusable.

- Skip unprocessable files instead of aborting; return skippedFiles in response
- Switch from fetch() to XHR with upload progress tracking (Uploading X%)
- Add Vite proxy timeout config (5min) to prevent connection drops on large uploads
- Add "Download Grouped" button: ZIP with each duplicate group in its own folder
- Add collapsible skipped-files section in the results UI
- Add 3 integration tests for skip behavior (43 total)
2026-05-13 11:35:33 +08:00
SnapOtter 3c3682661e fix: prevent image collapse in beautify preview when frame or watermark is active
The image element used flex: 1 1 0 (basis 0) inside the inline-flex
preview wrapper, causing it to collapse to zero height whenever a
device frame or watermark overlay was present. Changed to flex: 0 1 auto
so the image uses its intrinsic height and can shrink if needed.

Added regression e2e tests verifying every preset keeps the image
visible, and that adding a watermark does not collapse the image
regardless of whether a frame is active.
2026-05-13 11:23:54 +08:00
SnapOtter 48b795d073 fix: percent-encode X-File-Results header for non-ASCII filenames (#133)
Closes #133
2026-05-13 11:07:12 +08:00
SnapOtter abfad0de56 fix: progress bar not showing during stitch processing
setError() in the file store unconditionally set processing to false,
even when called with null to clear a previous error. This meant
setProcessing(true) followed by setError(null) at the start of
processing would immediately kill the processing state, preventing the
progress bar from ever rendering.

Fix setError to only reset processing when there is an actual error.
This also fixes the same latent bug in 10+ other custom tool settings
components that call setProcessing before setError.
2026-05-13 11:04:35 +08:00
SnapOtter 5a487746d0 fix: support SVGZ (gzip-compressed SVG) in SVG-to-raster tool 2026-05-13 10:58:23 +08:00
SnapOtter 8637105bce fix: add exotic format decoding to image-to-pdf tool 2026-05-13 10:39:38 +08:00
SnapOtter c15e94c969 fix: add exotic format decoding and SVG sanitization to all custom-route tools
Custom-route tools (split, compare, collage, find-duplicates, etc.) only
handled HEIC via ensureSharpCompat, failing on BMP, PSD, RAW, TGA, EXR,
HDR, JXL, and other formats Sharp cannot decode natively. Added the full
decode pipeline from createToolRoute to all 16 affected routes: format
validation via validateImageBuffer, HEIC decoding with actionable error
messages, CLI-based exotic format decoding with nested fallback, and SVG
sanitization to prevent XXE/SSRF/script injection.
2026-05-13 10:39:17 +08:00
SnapOtter f93e864094 fix: add progress bar and batch download to vectorize tool
The vectorize tool had a custom processing flow that bypassed the
standard useToolProcessor hook -- no progress indication, no server-side
batch, and the Download All ZIP relied on a client-side sequential loop.

Backend: extract core logic into vectorizeBuffer(), register via
registerToolProcessFn() so the /batch endpoint works with p-queue
concurrency and SSE progress events.

Frontend: replace custom fetch loop with useToolProcessor hook and
ProgressCard, giving upload progress, per-file batch status, and
automatic Download All ZIP via the existing tool-page infrastructure.

Also set image/svg+xml MIME type on SVG blobs during batch ZIP
extraction to ensure reliable rendering in <img> tags across browsers.
2026-05-13 10:36:35 +08:00
SnapOtter ac7d9cd591 fix: restrict SVG-to-raster dropzone to only accept SVG files
Adds fileFilter and acceptDescription props to Dropzone so tools can
restrict accepted file types across all entry paths (file picker,
drag-and-drop, paste, single URL import, bulk URL import).
2026-05-13 10:32:18 +08:00
SnapOtter bf01dcd47e fix: make beautify live preview reflect all settings in real time
Background images, device frames, custom shadows, and watermark text
were not rendering in the right-pane preview. The preview now updates
in real time for all settings: gradient/solid/image backgrounds, macOS/
Windows/Browser frame chrome, iPhone/MacBook/iPad frame indicators,
custom shadow parameters, and watermark text overlay.

Also fixes a React StrictMode effect-ordering race where the parent
tool-page reset cleared preview state set by the child Settings
component on initial mount.
2026-05-13 10:28:44 +08:00
SnapOtter 0874cfc809 fix: add exotic format decoding and upload progress to stitch tool
The stitch route only decoded HEIC via ensureSharpCompat, so exotic
formats (DNG, PSD, TGA, BMP, JXL, HDR, QOI, DDS, ICO, JP2, DPX, etc.)
crashed Sharp at metadata read time, causing "Stitch creation failed".
Add the full CLI decode pipeline (decodeToSharpCompat) matching the
tool-factory pattern, plus SVG sanitization with proper error handling
for each format category.

Replace fetch() with XMLHttpRequest in the frontend to surface upload
progress via onprogress events, and add a progress bar that shows upload
percentage then pulses during server-side stitching.
2026-05-13 10:27:59 +08:00
SnapOtter 35e8ff1c46 fix: use strict ASCII assertion in tests and update OpenAPI spec
Replace fragile Unicode-range regex with positive ASCII check
(/^[\x20-\x7E]+$/) that also catches emoji and supplementary plane
characters. Update OpenAPI spec to document percent-encoding.
2026-05-13 10:05:42 +08:00
SnapOtter ac8c585beb fix: percent-encode X-File-Results header to support non-ASCII filenames
The X-File-Results header contained raw JSON with non-ASCII characters
from filenames (Chinese, Japanese, etc.), violating RFC 7230. Node.js
threw ERR_INVALID_CHAR on writeHead(). Fixed by wrapping the JSON in
encodeURIComponent() on the backend and decodeURIComponent() on the
frontend, ensuring only ASCII goes into the header while preserving
the original filenames after decoding.

Closes #133
2026-05-12 23:19:20 +08:00
SnapOtter 2d17fd4903 fix: show real image dimensions in right pane for DNG/RAW files
The preview endpoint now returns X-Original-Width/Height headers with
dimensions read from Sharp metadata (or ExifTool for RAW files). The
frontend stores these in FileEntry and the ImageViewer prefers them over
the browser's naturalWidth/naturalHeight, which reflects the resized
preview rather than the original sensor dimensions.
2026-05-12 22:13:58 +08:00
SnapOtter 8c1526559b fix: read DNG/RAW metadata without full decode in image info tool
Sharp can read TIFF-based RAW files (DNG, CR2, NEF) directly for
metadata without requiring ImageMagick/darktable to fully decode them.
Try Sharp on the raw buffer first; only fall back to the decode pipeline
for formats Sharp cannot open (PSD, ICO, TGA). For RAW files, enrich
with ExifTool to get real sensor dimensions instead of thumbnail size.
2026-05-12 21:55:17 +08:00