heic-to 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/heic-to.d.ts +33 -0
- package/dist/heic-to.js +1 -1
- package/dist/heic-to.min.js +1 -1
- package/package.json +11 -2
- package/src/lib/libheif.js +15 -15
package/README.md
CHANGED
|
@@ -4,14 +4,14 @@ Convert HEIC/HEIF images to JPEG, PNG in browser using Javascript.
|
|
|
4
4
|
|
|
5
5
|
Inspired by [heic2any](https://github.com/alexcorvi/heic2any) and [libheif-web](https://github.com/joutvhu/libheif-web). The purpose of heic-to is to continuously follow up on releases of [libheif](https://github.com/strukturag/libheif) to be able to preview HEIC/HEIF images in browser.
|
|
6
6
|
|
|
7
|
-
Currently, heic-to is using libheif 1.18.
|
|
7
|
+
Currently, heic-to is using [libheif 1.18.2](https://github.com/strukturag/libheif/releases/tag/v1.18.2) under the hood.
|
|
8
8
|
|
|
9
9
|
### Usage
|
|
10
10
|
|
|
11
11
|
#### Check whether the image is HEIC or not
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
|
-
import { isHeic } from "
|
|
14
|
+
import { isHeic } from "heic-to"
|
|
15
15
|
|
|
16
16
|
const file = field.files[0]
|
|
17
17
|
await isHeic(file)
|
|
@@ -21,7 +21,7 @@ await isHeic(file)
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
import { heicTo } from "
|
|
24
|
+
import { heicTo } from "heic-to"
|
|
25
25
|
|
|
26
26
|
const file = field.files[0]
|
|
27
27
|
|
|
@@ -69,4 +69,4 @@ cd libheif
|
|
|
69
69
|
mkdir buildjs
|
|
70
70
|
cd buildjs
|
|
71
71
|
USE_WASM=0 ../build-emscripten.sh ..
|
|
72
|
-
```
|
|
72
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a file is in HEIC format.
|
|
3
|
+
* @param file - The file to check.
|
|
4
|
+
* @returns A promise that resolves to true if the file is HEIC, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isHeic(file: File): Promise<boolean>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Options for converting HEIC images.
|
|
10
|
+
*/
|
|
11
|
+
export interface HeicToOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The HEIC image blob to convert.
|
|
14
|
+
*/
|
|
15
|
+
blob: Blob;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The desired output image MIME type (e.g., 'image/jpeg', 'image/png').
|
|
19
|
+
*/
|
|
20
|
+
type: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The quality of the output image, between 0 and 1.
|
|
24
|
+
*/
|
|
25
|
+
quality?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Converts a HEIC image to another format.
|
|
30
|
+
* @param options - The conversion options.
|
|
31
|
+
* @returns A promise that resolves to the converted image blob.
|
|
32
|
+
*/
|
|
33
|
+
export declare function heicTo(options: HeicToOptions): Promise<Blob>;
|