heic-decode-esm
v2.0.4
Published
Decode HEIC images to raw data
Downloads
3
Readme
heic-decode
Decode HEIC images to extract raw pixel data. Works in NEXTJS
Usage
npm install heic-decode-esm
import convertHeic from "heic-decode-esm";
const data = await convertHeic.one({
buffer: await fs.readFile("in.heic"),
});
console.log({
width: data.width,
height: data.height,
buffer: data.buffer,
});
await fs.writeFile("out.png", data.buffer);
When the images are decoded, the return value is a plain object in the format of ImageData
. You can use this object to integrate with other imaging libraries for processing.
Note that while the decoder returns a Promise, it does the majority of the work synchronously, so you should consider using a worker thread in order to not block the main thread in highly concurrent production environments.
Dependencies
- libheif-wasm of libheif-js
- libheif
Related
- heic-cli - convert heic/heif images to jpeg or png from the command line
- heic-convert - convert heic/heif images to jpeg and png
- libheif-js - libheif as a pure-javascript npm module