-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageCompressor.d.ts
More file actions
43 lines (40 loc) · 1.08 KB
/
ImageCompressor.d.ts
File metadata and controls
43 lines (40 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export enum InputType {
base64 = "base64",
uri = "uri",
}
export enum OutputType {
jpeg = "jpeg",
png = "png",
}
export interface CompressorOptions {
/***
* The maximum width boundary used when compressing a landscape image.
*/
maxWidth: number
/***
* The maximum height boundary used when compressing a portrait image.
*/
maxHeight: number
/***
* The compression factor used when compressing JPEG images. Won't be used in PNG.
*/
quality: number
/***
* The type of data the input value contains.
*/
input: InputType
/***
* The output image type.
*/
output: OutputType
}
export default class ImageCompressor {
/***
* Resizes the image to the maximum boundary and compress into specified type
* and quality.
* @param {string} value The BASE64 string or file URI for input image.
* @param {CompressorOptions} options The options for the compressor to use.
* @returns {Promise<string>} BASE64 string representation of the compressed image.
*/
public static compress(value: string, options?: CompressorOptions): Promise<string>
}