JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 80897
  • Score
    100M100P100Q209679F

Streaming GIF encoder

Package Exports

  • gif-encoder

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 (gif-encoder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gif-encoder Build status

Streaming GIF encoder

This is built as part of the gifsockets project. It is forked from gif.js to allow for a streaming API and performance optimization.

Getting Started

Install the module with: npm install gif-encoder

// Create a 10 x 10 gif
var GifEncoder = require('gif-encoder');
var gif = new GifEncoder(10, 10);

// using an rgba array of pixels [r, g, b, a, ... continues on for every pixel]
// This can be collected from a <canvas> via context.getImageData(0, 0, width, height).data
var pixels = [0, 0, 0, 255, /*...*/];

process.nextTick(function () {
  // Write out the image into memory
  gif.writeHader();
  gif.addFrame(pixels);
  // Write subsequent rgba arrays for more frames
  gif.finish();
});

// Collect output
var data = [];
gif.on('data', function (val) {
  data.push(val);
});
gif.on('end', function () {
  // Data is an array of numeric byte values for the GIF
  done();
});

Documentation

(Coming soon)

// TODO: Document methods, events, and options

Examples

(Coming soon)

Donating

Support this project and others by twolfson via gittip.

Support via Gittip

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.

UNLICENSE

As of Nov 11 2013, Todd Wolfson has released all code differences since initial fork from gif.js to the public domain.

These differences have been released under the UNLICENSE.

At the gif.js time of forking, gif.js was using the MIT license.