heic-to 1.2.2 → 1.3.1
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/.tool-versions +1 -1
- package/LICENSE +177 -0
- package/README.md +12 -2
- package/dist/csp/heic-to.d.ts +28 -13
- package/dist/csp/heic-to.js +1 -1
- package/dist/csp/heic-to.min.js +1 -1
- package/dist/heic-to.d.ts +28 -13
- package/dist/heic-to.js +1 -1
- package/dist/heic-to.min.js +1 -1
- package/dist/iife/heic-to.js +20 -14
- package/dist/next/heic-to.d.ts +28 -13
- package/dist/next/heic-to.js +1 -1
- package/example/bitmap/app.js +28 -0
- package/example/bitmap/index.html +47 -0
- package/package.json +1 -1
- package/src/index.js +20 -14
- package/src/next/index.js +15 -25
package/dist/next/heic-to.d.ts
CHANGED
|
@@ -5,29 +5,44 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function isHeic(file: File): Promise<boolean>;
|
|
7
7
|
|
|
8
|
+
type ImageMime = `${"image"}/${string}`; // e.g. "image/jpeg", "image/png", "image/webp"
|
|
9
|
+
type HeicTarget = "bitmap" | ImageMime;
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
12
|
+
* Converts a HEIC image to another format.
|
|
13
|
+
* @param args - The conversion options.
|
|
14
|
+
* @returns A promise that resolves to the converted image bitmap.
|
|
10
15
|
*/
|
|
11
|
-
export
|
|
16
|
+
export function heicTo(args: {
|
|
12
17
|
/**
|
|
13
18
|
* The HEIC image blob to convert.
|
|
14
19
|
*/
|
|
15
20
|
blob: Blob;
|
|
16
|
-
|
|
21
|
+
type: "bitmap";
|
|
17
22
|
/**
|
|
18
|
-
*
|
|
23
|
+
* Options for creating the ImageBitmap.
|
|
19
24
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* The quality of the output image, between 0 and 1.
|
|
24
|
-
*/
|
|
25
|
-
quality?: number;
|
|
26
|
-
}
|
|
25
|
+
options?: ImageBitmapOptions;
|
|
26
|
+
quality?: never;
|
|
27
|
+
}): Promise<ImageBitmap>;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Converts a HEIC image to another format.
|
|
30
|
-
* @param
|
|
31
|
+
* @param args - The conversion options.
|
|
31
32
|
* @returns A promise that resolves to the converted image blob.
|
|
32
33
|
*/
|
|
33
|
-
export
|
|
34
|
+
export function heicTo<M extends Exclude<HeicTarget, "bitmap">>(args: {
|
|
35
|
+
/**
|
|
36
|
+
* The HEIC image blob to convert.
|
|
37
|
+
*/
|
|
38
|
+
blob: Blob;
|
|
39
|
+
/**
|
|
40
|
+
* The desired output image MIME type (e.g., 'image/jpeg', 'image/png').
|
|
41
|
+
*/
|
|
42
|
+
type: M;
|
|
43
|
+
/**
|
|
44
|
+
* The quality of the output image, between 0 and 1.
|
|
45
|
+
*/
|
|
46
|
+
quality?: number; // 0..1 for JPEG/WEBP, ignored by PNG
|
|
47
|
+
options?: never;
|
|
48
|
+
}): Promise<Blob>;
|