2.0.4 • Published 10 months ago

heic-decode-esm v2.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

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

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
2.0.4

10 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago