-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
52 lines (40 loc) · 1.48 KB
/
index.d.ts
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
44
45
46
47
48
49
50
51
52
import type { JpegOptions, WebpOptions } from 'sharp'
export type LqipModernFormat = 'webp' | 'jpeg'
export type LqipModernOutput = {
/** Raw content of the resized output image. */
content: Buffer
metadata: {
/** Width of the original image. */
originalWidth: number
/** height of the original image. */
originalHeight: number
/** Width of the output image. */
width: number
/** Height of the output image. */
height: number
/** Type of the output image. **/
type: LqipModernFormat
/** Output image as a data URI. */
dataURIBase64: string
}
}
export type LqipModernOptions = {
/**
* Output format to use; either `webp` or `jpeg` (passing `jpg` is the same as passing `jpeg`).
*/
outputFormat?: 'webp' | 'jpeg' | 'jpg'
/**
* Output options passed to either `sharp.webp` or `sharp.jpeg` dependent on `opts.outputFormat`.
*/
outputOptions?: WebpOptions | JpegOptions
/**
* Options to pass to `sharp.resize`. Defaults to resizing inputs to a max dimension of `16`, with the other dimension being calculated to maintain aspect ratio. If you want more control, you can pass an array of args here which will be forwarded to `sharp.resize`.
*/
resize?: number | number[]
/** Concurrency when processing an array of input images. */
concurrency?: number
}
export default function lqipModern(
input: string | string[] | Buffer | Buffer[] | ArrayBuffer | ArrayBuffer[],
opts?: LqipModernOptions
): Promise<LqipModernOutput>