Capability first · transport second

GifEncoder.js

Encodes indexed frames into a bounded animated GIF using palette mapping and LZW.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Encodes indexed frames into a bounded animated GIF using palette mapping and LZW.

  • Artifact
    GifEncoder.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Normalized byte output and bounds.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/GifEncoder.js';

Holds indexed frames in memory; encode allocates and returns a GIF Blob without I/O.

Application-facing behavior: default GifEncoder, indexPixels(), lzw().

Protocol and host implementation

In-process only This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
defaultdefault · classclass GifEncoder
indexPixelsfunctionfunction indexPixels(data)data
lzwfunctionfunction lzw(indices)indices
CallableKindExact public signatureParameter syntax
indexPixelsexported-functionfunction indexPixels(data)data
lzwexported-functionfunction lzw(indices)indices
MemberKindExact public declarationParameter syntax
GifEncoder.constructorconstructorconstructor(width,height,{loop=0}={})width,height,{loop=0}={}
GifEncoder.addFramemethodaddFrame(imageData,{delay=250}={})imageData,{delay=250}={}
GifEncoder.encodemethodencode()

Parameter meanings and results

GifEncoder(width, height, {loop}).addFrame(imageData, {delay}) returns the frame count, and encode() returns an image/gif Blob. indexPixels maps RGBA to the fixed palette, and lzw returns compressed byte numbers.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • RangeError for mismatched frame dimensions
  • Error when encoding without frames

Availability and capabilities

Cross-host. Normalized byte output and bounds.

Cross-host first-party bounded GIF encoding with no Core dependency.

Contract example

JavaScript
import GifEncoder from '/arcane/modules/GifEncoder.js';

const encoder=new GifEncoder(1,1);
encoder.addFrame(
    new ImageData(new Uint8ClampedArray([255,0,0,255]),1,1),
    {delay:100}
);
console.log(encoder.encode());

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.