How one developer added HEIC support by lazy-loading a 510 KB decoder only when needed

A developer building the ImgIng tool found that neither Chromium nor Firefox natively supports HEIC image decoding, with only WebKit on macOS able to handle the format via the system decoder. To avoid burdening all users with a 1.46 MB WASM-based decoder library, the tool attempts a native decode first and only prompts a download if that fails. The decoder, which compresses to roughly 510 KB over the wire, is cached after the first download and silently reloaded on return visits, meaning most users never pay the bandwidth cost. The developer also found that converting HEIC output to JPEG at quality 80 was far more efficient than PNG, though file sizes varied depending on image content. The key takeaway is to test native decode support before lazy-loading any third-party decoder, and to benchmark output formats against real user images before committing to one.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in