Class

GIF

GIF(frames, loopCountopt)

Represents a GIF image as an array of frames

Constructor

# new GIF(frames, loopCountopt)

Parameters:
Name Type Attributes Default Description
frames Array.<Frame>

The frames to create the GIF from

loopCount number <optional>
0

How often to loop the GIF for (-1 = unlimited)

Properties:
Name Type Description
loopCount number

How often the GIF will loop for

View Source ImageScript.js, line 1359

Extends

Members

# duration

The GIFs duration (in ms)

View Source ImageScript.js, line 1434

# height

The GIFs height

View Source ImageScript.js, line 1398

# width

The GIFs width

View Source ImageScript.js, line 1383

Methods

# async static decode(data, onlyExtractFirstFrameopt) → {Promise.<GIF>}

Decodes a GIF image

Parameters:
Name Type Attributes Default Description
data Buffer | Uint8Array

The binary data to decode

onlyExtractFirstFrame boolean <optional>
false

Whether to end GIF decoding after the first frame

View Source ImageScript.js, line 1471

The decoded GIF

Promise.<GIF>

# async encode(qualityopt) → {Promise.<Uint8Array>}

Encodes the image into a GIF

Parameters:
Name Type Attributes Default Description
quality number <optional>
95

GIF quality 0-100

View Source ImageScript.js, line 1443

The encoded data

Promise.<Uint8Array>