Skip to content

59naga/pixel-gif-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Parse GIF to ImageData in cross-platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published