pixel-gif
v0.0.1
Published
Parse Gif to ImageData in cross-platform
Downloads
81
Readme
PixelGif
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 ofImageData
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 ..> }
// ...