libheif-web
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Libheif for Web

An emscripten build of libheif distributed as an npm module for the browser.

Installation

npm i libheif-web

Set libheif url

Download libheif.min.js from the libheif v1.12.0 release and put it in your project's assets folder.

Use following code to set url for libheif.

import {useUrl} from 'libheif-web';

useUrl('assets/scripts/libheif.min.js');

If you skip this step the url will automatically point to libheif.min.js

Using

import {convertHeif, convertAllOfHeif} from 'libheif-web';

const pngImage = await convertHeif(heicFile, 'filename.png', 'image/png');

const images = await convertAllOfHeif(heicFile);
const firstPng = await images[0].convert('filename.png', 'image/png');
const secondPng = await images[1].convert('filename.png', 'image/png');

Readme

Keywords

Package Sidebar

Install

npm i libheif-web

Weekly Downloads

125

Version

1.0.2

License

MIT

Unpacked Size

89.5 kB

Total Files

18

Last publish

Collaborators

  • jout