Node / Gif Animation · reference
Canvas size, encoder & output formats
Current Apexify.js 6.0.0 documentation for Canvas size, encoder & output formats.
Dimensions
| Field | Default | Role |
|---|---|---|
width | 1200 | GIF encoder canvas width. |
height | 1200 | GIF encoder canvas height. |
width and height must be supplied together when either is provided. The dimensions are checked against the central GIF dimension/resource-cost limits before encoding work proceeds.
Every resolved frame is cleared into and drawn onto this output canvas. Sources with different dimensions are stretched to the configured output dimensions. Exact-size sources can skip redundant scaling when skipResizeWhenDimensionsMatch is omitted or true.
Encoder tuning
| Field | Default | Role |
|---|---|---|
repeat | 0 | Repeat mode: -1 = play once, 0 = loop indefinitely, positive values = finite repeat count. |
quality | 10 | Quantizer sample interval 1…30. Lower values improve color mapping at higher CPU cost. |
delay | 100 ms fallback | Used when a frame omits its own duration. |
A provided delay must be finite and within the encoder-supported range. GIF timing is represented in 10 ms units internally.
frameCount and duration can provide bounds/hints for generated-frame mode. They do not permit a producer to exceed central maxGifFrames or aggregate GIF resource limits.
outputFormat (required)
| Value | Behaviour |
|---|---|
file | Streams encoded bytes to outputFile (required), waits for the file stream to finish, validates the GIF signature, then resolves undefined unless onEnd returns a static image. Partial files are removed on failure. |
buffer | Fully drains the encoder stream and returns a GIF Buffer after signature validation. |
base64 | Fully drains the encoder stream, validates it, then returns buffer.toString('base64'). No data-URL prefix is added. |
attachment | Fully drains and validates the encoder stream, then returns GIFAttachment[] containing Buffer-backed GIF bytes, a .gif filename, and contentType: 'image/gif'. |
Unsupported output strings are rejected by validation.
Attachment naming
attachmentName is optional and must be a filename, not a path. Default: image.gif. If the supplied name does not already end in .gif, Apexify appends the extension.
File example
The method resolves only after the file output has finished and passed the GIF signature check.