# BriskFiles HEIC decoder: source, build and replacement

Build: heic-to 1.6.7-briskfiles.1, October 30, 2026.

The production decoder is built from the supplied libheif 1.23.7 and libde265 1.0.16 source archives, with Emscripten 6.0.13, CMake 4.4.4, Ninja 1.13.2 and esbuild 0.28.2. The native source trees are unmodified. Only libde265 is enabled as an external codec; other optional codecs, plugin loading and libheif multithreading are disabled. The included build-native.ps1 records every configure and linker argument. This is a JavaScript (USE_WASM=0) build, matching the original wrapper's loading model.

## Downloads

manifest.json and SHA256SUMS.txt list provenance, sizes and SHA-256 hashes. Check with sha256sum -c SHA256SUMS.txt. All source downloads are available without charge or an account at https://briskfiles.com/open-source.

- libheif-1.23.7.tar.gz and libde265-1.0.16.tar.gz: complete upstream native source trees, copyright notices and licenses.
- briskfiles-heic-build-source.tar.gz: the wrapper source actually used, its generated native decoder, upstream license/README/package metadata. The worker has one documented modification: it awaits the Emscripten 6 module factory before decoding. The generated native file adds an ES-module export for the wrapper. These modifications are dated October 30, 2026 and distributed under the upstream LGPL terms.
- heic-to-1.6.7.tgz: the original, unchanged npm package for reference. Its prebuilt decoder is not used by this release.
- briskfiles-heic-integration.tar.gz: a standalone HEIC page, integration JavaScript/CSS, decoder and license notices, with permission to modify/recombine the integration for LGPL purposes.
- build-native.ps1 and rebuild-wrapper.cjs: the actual native and wrapper build scripts. build-emscripten-upstream.sh is the unchanged upstream alternative, included for reference.
- Emscripten-LICENSE.txt, musl-COPYRIGHT.txt and LLVM-runtime-LICENSE.txt: runtime notices, in addition to the component licenses in the source archives and the LGPL/GPL texts linked from the notices page.

## Rebuild the native decoder on Windows

Use a working directory with several GB free. These tools can be installed locally without changing machine settings. Install Python, Node.js and PowerShell 7. Download the source archives and scripts into that working directory. Extract the two native archives with tar -xzf FILE so the directories are libheif-1.23.7 and libde265-1.0.16.

    git clone https://github.com/emscripten-core/emsdk.git emsdk
    python emsdk/emsdk.py install 6.0.13
    python emsdk/emsdk.py activate 6.0.13
    python -m pip install --target python-tools cmake==4.4.4 ninja==1.13.2
    pwsh -File build-native.ps1

The SDK's pinned build is eb132757325583b787fe9414b09afea9442b72ad. The script expects the SDK's bundled Python 3.13.3 directory and the pip tool layout above. Its environment changes apply only to the build process. On success libheif-rebuilt.js contains the native decoder and wrapper module export. Emscripten currently warns that WASM=0 is deprecated; this pinned version successfully built and tested it. A future compiler may require build changes.

## Rebuild the wrapper

Extract briskfiles-heic-build-source.tar.gz into a directory named package. For a complete native rebuild, replace package/src/lib/libheif.js with the libheif-rebuilt.js produced above. To rebuild just the wrapper, retain its supplied generated file.

    npm install --ignore-scripts esbuild@0.28.2
    node rebuild-wrapper.cjs package rebuilt-heic-to.js

The script builds the worker and window.HeicTo IIFE. esbuild needs its platform executable, supplied by its matching optional platform package. Native and wrapper rebuilding were executed successfully; a modified compatible wrapper also passed conversion tests in Chromium, Firefox and WebKit. Different paths or toolchain versions can change the output bytes. Byte-for-byte identity is not necessary to use a compatible replacement.

## Replace and relink the application

1. Extract the integration archive. In assets/app.js replace the decoder URL with your compatible replacement, for example /assets/heic-to-custom.js, and save rebuilt-heic-to.js at that location. The interface is window.HeicTo({blob, type, quality}), returning a Promise of a JPEG Blob.
2. Calculate SHA-384 of the replacement bytes with Node: require('node:crypto').createHash('sha384').update(require('node:fs').readFileSync('rebuilt-heic-to.js')).digest('base64'). Prefix the result with sha384- and replace the script.integrity value in app.js. Keep integrity protection enabled.
3. Serve the archive directory over localhost HTTP, for example python -m http.server 8080. Open http://localhost:8080/heic-to-jpg.html, convert a HEIC, inspect the output and confirm the replacement URL in the browser network panel. No signing key, vendor approval, payment or activation is required.
4. In the Next.js project, the corresponding files are public/assets/app.js and public/assets/DECODER.js. Update those files and run the normal static build.

APPLICATION-PERMISSION.txt permits integration modification and recombination for LGPL purposes, including reverse engineering to debug library modifications. Third-party licenses govern their components and remain in effect. Preserve license/copyright notices and provide the source/build materials for your modified library when distributing it under its license. Contact support@briskfiles.com about missing source or notices.

These materials document the implementation and source/replacement work. They are not a legal opinion or patent clearance.