-
Notifications
You must be signed in to change notification settings - Fork 26
/
gif-frames.d.ts
48 lines (41 loc) · 1.41 KB
/
gif-frames.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
import {Initializer} from "multi-integer-range";
import {Canvas} from "canvas";
import stream from "stream";
declare module "gif-frames" {
export default function gifFrames<T extends GifFrameOptions>(options: T): Promise<GifFrameData<T>[]>;
export default function gifFrames<T extends GifFrameOptions>(options: T, callback: (err: Error, frameData: GifFrameData<T>[]) => void): void;
type GifOutputType = "jpeg" | "jpg" | "gif" | "png" | "canvas";
type GifFrameData<T extends GifFrameOptions> = T["outputType"] extends "canvas" ? GifFrameCanvas : GifFrameReadableStream;
interface GifFrameOptions {
url: string | Buffer;
frames: "all" | Initializer;
outputType?: GifOutputType;
quality?: number;
cumulative?: boolean;
}
interface GifFrameCanvas {
getImage(): Canvas;
frameIndex: number;
frameInfo: GifFrameInfo
}
interface GifFrameReadableStream {
getImage(): stream.Readable;
frameIndex: number;
frameInfo: GifFrameInfo
}
interface GifFrameInfo {
x: number;
y: number;
width: number;
height: number;
has_local_palette: boolean;
palette_offset: number;
palette_size: number;
data_offset: number;
data_length: number;
transparent_index: number;
interlaced: boolean;
delay: number;
disposal: number;
}
}