pixel-gif

0.0.1 • Public • Published

PixelGif NPM version Build Status Coverage Status

Sauce Test Status

Parse Gif to ImageData in cross-platform.

Installation

$ npm install pixel-gif --save
var pixelGif= require('pixel-gif');
console.log(pixelGif); //object

API

pixelGif.parse(file) -> promise.then(images)

return images is Array contains one or more ImageData.

Return the object instead of ImageData at Node.js

var file= 'https://59naga.github.io/fixtures/animated.GIF';
 
pixelGif.parse(file).then(function(images){
  var i= 0;
 
  console.log(images.loopCount); // 0(Infinite)
 
  var nextImage= function(){
    var imageData= images[i++];
    if(imageData==null) return;
 
    console.log(imageData);
    nextImage();
  }
 
  nextImage();
});
// { width: 73, height: 73, x: 0, y: 0, has_local_palette: false, palette_offset: 13, data_offset: 818, data_length: 393, transparent_index: null, interlaced: false, delay: 1000, disposal: 0, data: <Uint8Array ..> }
// { width: 73, height: 73, x: 0, y: 0, has_local_palette: false, palette_offset: 13, data_offset: 1229, data_length: 387, transparent_index: null, interlaced: false, delay: 900, disposal: 0, data: <Uint8Array ..>  }
// { width: 73, height: 73, x: 0, y: 0, has_local_palette: false, palette_offset: 13, data_offset: 1634, data_length: 393, transparent_index: null, interlaced: false, delay: 800, disposal: 0, data: <Uint8Array ..>  }
// ...

See

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i pixel-gif

Weekly Downloads

10

Version

0.0.1

License

MIT

Last publish

Collaborators

  • 59naga