feat(m4): cap map images at Full HD and shrink on import (#85)

The owner fixed the map cap at 1920 px on the long side and 1080 px on the
short side (either orientation). fff-vtt import now shrinks a larger source
with ImageMagick Lanczos before tiling (alpha kept, proportions preserved,
no upscaling), prints `scaled WxH -> WxH`, and records the shrunk w/h; a
source at or below the cap is untouched, so the pixel-identity tests still
hold. A scene row already above the cap is not rewritten: the server logs
`map_above_cap` at startup and serve prints the re-import advice.

Docs: ADR-0023, DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README,
HANDOFF-M4, client README. The M4 phone gate and the fogbench measurement
now use the Full HD maximum; the 16384 px / 262144-cell bench and test rows
stay as labelled server stress references. import-scale now proves a 16384²
input is shrunk to 1080x1080 (289 tiles at 64 px) quickly and bounded.

Part of #63, #85. #77 is blocked by this issue.
This commit is contained in:
2026-11-21 22:16:08 +01:00
parent 30b35592c7
commit 43947d1197
22 changed files with 515 additions and 193 deletions
+8
View File
@@ -2490,6 +2490,14 @@ proc runServer(cfg: Config): int =
lg.log(lvError, "scene_missing", [("path", cfg.dbPath), ("scene", $DefaultSceneId)])
return 1
state.scene = loaded.get
# #85: a scene imported before the Full HD cap is left as it is on disk, but the operator is
# told once at startup that the map is above the product maximum and should be re-imported.
if exceedsMapCap(state.scene.w, state.scene.h):
lg.log(lvWarn, "map_above_cap", [
("w", $int(state.scene.w)), ("h", $int(state.scene.h)),
("cap", $MapCapLongSide & "x" & $MapCapShortSide),
("detail", "map is " & $int(state.scene.w) & "x" & $int(state.scene.h) &
", above the Full HD cap; re-import to shrink")])
state.tokens = loadTokens(conn, state.scene.id)
# 8 / slice 8: the characters, the per-player reveals and the encountered snapshots.
state.characters = characters.loadCharacters(conn)