- A wasm build of libheif whose only purpose is to decode
.heifimage or the first image of a.heicfor use in a browser. Its size is half of other libraries likeheic2anyorheic-to. - Used in SnapFridge
- Version: libde265 1.0.16, libheif 1.20.1, emscripten 4.0.12
Try to use Ninja
git clone --depth 1 https://github.com/msqr1/Heic-D-Code &&
cd Heic-D-Code &&
cmake -P Setup.cmake &&
source emsdk/emsdk_env.sh &&
mkdir build &&
cd build &&
emcmake cmake .. -DCMAKE_BUILD_TYPE=Release &&
cmake --build . --config Release -j$(nproc)import initDecoder from "./Heic-D-Code.js";
const decoder = await initDecoder();
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
try {
const heic = await fetch("example.heic");
const inData = await heic.bytes();
const decodeOutput = decoder.decode(inData);
canvas.width = width;
canvas.height = height;
ctx.putImageData(new ImageData(...decodeOutput), 0, 0);
} catch (e) {
console.log(e);
}