Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joutvhu/libheif-web
An emscripten build of libheif distributed as an npm module for the browser.
https://github.com/joutvhu/libheif-web
browser convert heif-converter libheif typescript
Last synced: about 2 months ago
JSON representation
An emscripten build of libheif distributed as an npm module for the browser.
- Host: GitHub
- URL: https://github.com/joutvhu/libheif-web
- Owner: joutvhu
- License: mit
- Created: 2022-08-02T11:29:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T16:14:02.000Z (about 2 months ago)
- Last Synced: 2024-11-01T19:03:16.217Z (about 2 months ago)
- Topics: browser, convert, heif-converter, libheif, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/libheif-web
- Size: 2.08 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Libheif for Web
An emscripten build of [libheif](https://github.com/strukturag/libheif) distributed as an npm module for the browser.
## Installation
```shell
npm i libheif-web
```### Set libheif url
Download [libheif.min.js](https://github.com/joutvhu/libheif-web/releases/download/v1.14.0_libheif/libheif.min.js) from the [libheif v1.14.0 release](https://github.com/joutvhu/libheif-web/releases/tag/v1.14.0_libheif) and put it in your project's `assets` folder.
Use following code to set url for libheif.
```ts
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](https://github.com/joutvhu/libheif-web/releases/download/v1.14.0_libheif/libheif.min.js)
## Using
```ts
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');
```