gifuct-js

日本語のREADMEはこちらです: README.ja.md

A Simple to use JavaScript .GIF decoder.

Demo

You can see a demo of this library in action here.

Features

Usage

Decoding

The decoder uses js-binary-schema-parser to parse the GIF files. The GIF file must first be converted into a Uint8Array buffer to decode it:

import { parseGIF, decompressFrames } from 'https://code4fukui.github.io/gifuct-js/src/index.js';

const buff = await (await fetch(gifURL)).arrayBuffer();
const gif = parseGIF(buff);
const frames = decompressFrames(gif, true)
console.log(frames);

The decompressFrames function returns an array of all the GIF image frames and their metadata, including pixels, dims, delay, disposalType, colorTable, transparentIndex, and an optional patch data.

Drawing the GIF

The library provides an easy interface for creating commonly used canvas pixel data for drawing. Check out the demo for an example of how to draw and manipulate a GIF using this library.

License

MIT License — see LICENSE.