converting HEIC/HEIF image files to JPEG/PNG/GIF in the browser. This tool is specifically for the browser environment, it WILL NOT work in node environment.
- Installation: yarn
yarn add heic2any
- Installation: npm
npm install heic2any
- Installation: no module bundler
<!-- just include the file in a script tag -->
<script src="./dist/index.js">
- Usage: Typescript & Javascript
import heic2any from "heic2any";
// or
const heic2any = require("heic2any");
// skip the lines above if you're not using a module bundler
// and would prefer to include a <script> tag in your HTML file
// this is our heif image file
const HEICBlobFile = new Blob();
heic2any({
// required: the HEIF blob file
blob: HEICBlobFile,
// (optional) MIME type of the target file
// it can be "image/jpeg", "image/png" or "image/gif"
// defaults to "image/png"
toType: "image/jpeg",
// conversion quality
// a number ranging from 0 to 1
quality: 0.8
});
This project is heavily based on the excellent libheif by struktur.