Skip to content

v2.1.1 - PNG compression fix

Choose a tag to compare

@MirabelleBenou MirabelleBenou released this 18 May 22:22
bc45638

[2.1.1] — 2026-05-19

Fixed

  • Charts and Annexes images were not compressed on upload (regression introduced in v2.1.0).
    Both new sections — Charts and Annexes — bypassed the canvas-based compression pipeline and stored raw uploaded files (including 4–5 MB PNGs with alpha channel) directly into the briefing state. Briefings with a couple of high-resolution screenshots could easily exceed 10 MB once exported to PDF, which made them unshareable via Discord.
    The change listeners in renderCharts and renderAnnexes now call compressImageFile(f) like the other sections (Cover, SITAC, Phases, Radio Plan), producing JPEG q82 at most 1600 px wide on a white background.

Added

  • Silent auto-recompression of legacy briefings.
    A new function recompressOversizedImagesInState(state) walks the briefing state at load time and recompresses any embedded image whose base64 payload exceeds 800 KB. It runs in two places:
    • On JSON import (loadJsonFile) — awaited, followed by an immediate state persist and a discreet toast notification.
    • On app startup (init) — non-blocking; the UI renders immediately and the optimization happens in the background, then persists and refreshes the preview when done.
      Image paths visited are explicit (no magic walk): cover.mapImage, sitac.mapImage, phases[*].mapImage, phases[*].images[*].data, charts[*].img, annexes[*].img, radioPlan.aircraftPlans[*].image.
  • New constant IMG_RECOMPRESS_THRESHOLD = 800 * 1024 (configurable via build_html.py).