Skip to content

Function: toGif() ​

ts
function toGif(url, options?): Promise<GifResult>;

Convert a segment of a video to an animated GIF.

Parameters ​

ParameterTypeDescription
urlstringLocal path of the video.
optionsPartial<GifOptions>Segment, frame rate and width of the GIF.

Returns ​

Promise<GifResult>

The path of the GIF, written to the cache directory.

Example ​

ts
const { outputPath } = await toGif(videoUri, { startTime: 2_000, endTime: 7_000, fps: 15, width: 320 });

Released under the MIT License.