JSPM

decode-gif

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13855
  • Score
    100M100P100Q128971F
  • License MIT

Decode the frames of a gif.

Package Exports

  • decode-gif

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (decode-gif) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

decode-gif Travis CI Build Status

Decode the frames of a gif.

NPM Badge

Install

npm install decode-gif

Usage

const fs = require("fs");
const decodeGif = require("decode-gif");

decodeGif(fs.readFileSync("unicorn.gif"));
/*
{
  width: 220,
  height: 165,
  frames: [
    { timeCode: 0, data: [Uint8ClampedArray] },
    { timeCode: 10, data: [Uint8ClampedArray] },
    ...
  ]
}
*/

API

decodeGif(data)

data

Type: array-like

The gif data. Can be anything array-like such as a Buffer, Array or Uint8Array.

Return value

width

Type: number

The width of the gif.

height

Type: number

The height of the gif.

frames

An array of each frame of the gif.

frame.timeCode

The time code in milliseconds that the frame appears at.

frame.data

The frame data as a Uint8ClampedArray.