Keep animated images animated in the optimizer

- Animated WebP (J-82) was being flattened to its first frame: browsers
  have no animated WebP encoder, so the modal now sniffs the file header
  (4 KB range request), explains the limitation and disables Process
  instead of overwriting the file with a single frame.
- APNGs saved as .png took the still-image path and lost their frames;
  the header sniff looks for the acTL chunk, routes them to the animation
  pipeline (all frames + delays) and switches the UI to the animation
  options. The worker double-checks the header too, so no path can
  flatten an APNG.
- New dependency-free imageformat module, verified against real files
  (J-82 animated, static WebP/PNG, and a generated APNG named .png).
This commit is contained in:
2026-09-17 21:57:02 -05:00
parent 38e64140ed
commit a152063d76
4 changed files with 120 additions and 2 deletions
+4
View File
@@ -113,6 +113,10 @@ Files now stage first and are resolved before entering the library.
- [x] Apply overwrites the same J-ID: `POST /api/files/J-x/optimize/` replaces
the file(s) and recomputes MD5/size/perceptual hashes (409 when the
result matches another item, 400 when it is identical)
- [x] Animated formats are detected by header (APNG `acTL` chunk, WebP
`VP8X` flag), so APNGs keep their frames and animated WebP is refused
with a notice instead of being flattened (browsers have no animated
WebP encoder)
- [x] **Stats dashboard** (`/stats`, staff)
- [x] CPU / RAM / GPU / disk usage (`psutil` + `nvidia-smi`; capacity bars
follow the design system's 80% / 95% colour thresholds)