JSPM

libheif-web

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 280
  • Score
    100M100P100Q84811F
  • License MIT

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

Package Exports

  • libheif-web
  • libheif-web/bundles/index.js
  • libheif-web/fesm2015/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (libheif-web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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');