npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gify-parse

v1.0.7

Published

An API for parsing information on (animated) GIF files.

Downloads

1,841

Readme

gify-parse

A Node.js module for parsing information on (animated) GIF files.

Notes

gify-parse is just a fork of gify by rfrench that is intended to encapsulate the logic into a Node.js module and to provide a command-line interface.

Installation

Install via npm registry:

$ npm install gify-parse

or

Install via git clone:

$ git clone git://github.com/jonashavers/node-gify-parse.git
$ cd node-gify-parse
$ npm install
  

Usage

Usage inside your Node.js modules:

var fs = require('fs');
var gifyParse = require('gify-parse');

var buffer = fs.readFileSync('test.gif');
var gifInfo = gifyParse.getInfo(buffer);

console.log(gifInfo);

Usage of the CLI (command-line interface):

$ gifyParse <file> [option]

e.g.

$ gifyParse test.gif
$ gifyParse test.gif -p duration
$ gifyParse test.gif -p images.0.delay

The examples above parse the file test.gif and print out the GIF file's information on the console.

Requirements

gify-parse requires

Methods

  • isAnimated(sourceArrayBuffer) (bool)
  • getInfo(sourceArrayBuffer) (gifInfo)

info Properties

  • valid (bool) - Determines if the GIF is valid.
  • animated (bool) - Determines if the GIF is animated.
  • globalPalette (bool) - Determines if the GIF has a global color palette.
  • globalPaletteSize (int) - Size of the global color palette.
  • globalPaletteColorsRGB ([r,g,b]) - An array of objects containing the R, G, B values of the color palette. (Beppe)
  • height (int) - Canvas height.
  • width (int) - Canvas width.
  • loopCount (int) - Total number of times the GIF will loop. 0 represents infitine.
  • images ([images]) - Array of images contained in the GIF.
  • isBrowserDuration (bool) - If any of the delay times are lower than the minimum value, this value will be set to true.
  • duration (int) - Actual duration calculated from the delay time for each image. If isBrowserDuration is false, you should use this value.
  • durationIE (int) - Duration for Internet Explorer (16fps)
  • durationSafari (int) - Duration for Safari in milliseconds (16fps)
  • durationFirefox (int) - Duration for Firefox in milliseconds (50fps)
  • durationChrome (int) - Duration for Chrome in milliseconds (50fps)
  • durationOpera (int) - Duration for Opera in milliseconds (50fps)

image Properties

  • top (int) - Image top position (Y).
  • left (int) - Image left position (X).
  • height (int) - Image height.
  • width (int) - Image width.
  • localPalette (bool) - Image has a local color palette.
  • localPaletteSize (int) - Size of the local color palette.
  • interlace (bool) - Image is/is not interlaced.
  • delay (int) - Delay time in milliseconds.
  • disposal (int) - Disposal method. (0-7). See this for more details.

Example

{ valid: true,
  globalPalette: true,
  globalPaletteSize: 256,
  globalPaletteColorsRGB: 
   [ { r: 142, g: 44, b: 14 },
     { r: 109, g: 32, b: 15 },
     { r: 143, g: 37, b: 16 },
     { r: 150, g: 53, b: 17 },
     { r: 56, g: 21, b: 1 },
     { r: 136, g: 41, b: 14 },
     { r: 59, g: 14, b: 0 },
     { r: 140, g: 42, b: 10 },
     { r: 120, g: 68, b: 37 },
     { r: 120, g: 56, b: 36 },
     { r: 102, g: 51, b: 21 },
     { r: 103, g: 54, b: 35 },
     { r: 121, g: 100, b: 75 },
     { r: 154, g: 115, b: 87 },
     { r: 86, g: 51, b: 21 },
     { r: 69, g: 20, b: 3 },
     { r: 177, g: 139, b: 145 },
     { r: 119, g: 72, b: 50 },
     { r: 102, g: 69, b: 39 },
     { r: 86, g: 38, b: 19 },
     { r: 137, g: 99, b: 72 },
     { r: 206, g: 77, b: 80 },
     { r: 165, g: 115, b: 87 },
     { r: 172, g: 52, b: 42 },
     { r: 121, g: 84, b: 55 },
     { r: 220, g: 138, b: 103 },
     { r: 86, g: 36, b: 5 },
     { r: 54, g: 18, b: 1 },
     { r: 135, g: 89, b: 68 },
     { r: 119, g: 88, b: 68 },
     { r: 135, g: 69, b: 52 },
     { r: 157, g: 120, b: 140 },
     { r: 72, g: 36, b: 19 },
     { r: 71, g: 35, b: 5 },
     { r: 102, g: 39, b: 19 },
     { r: 137, g: 104, b: 83 },
     { r: 209, g: 110, b: 77 },
     { r: 151, g: 106, b: 84 },
     { r: 135, g: 54, b: 37 },
     { r: 211, g: 181, b: 210 },
     { r: 174, g: 133, b: 114 },
     { r: 104, g: 71, b: 51 },
     { r: 101, g: 36, b: 5 },
     { r: 107, g: 21, b: 4 },
     { r: 210, g: 107, b: 109 },
     { r: 168, g: 71, b: 52 },
     { r: 254, g: 245, b: 254 },
     { r: 85, g: 36, b: 35 },
     { r: 155, g: 119, b: 100 },
     { r: 86, g: 22, b: 2 },
     { r: 206, g: 82, b: 54 },
     { r: 135, g: 68, b: 36 },
     { r: 182, g: 150, b: 167 },
     { r: 209, g: 85, b: 104 },
     { r: 88, g: 53, b: 35 },
     { r: 134, g: 86, b: 55 },
     { r: 175, g: 103, b: 49 },
     { r: 207, g: 171, b: 182 },
     { r: 229, g: 110, b: 136 },
     { r: 152, g: 104, b: 72 },
     { r: 71, g: 22, b: 18 },
     { r: 153, g: 69, b: 52 },
     { r: 136, g: 53, b: 21 },
     { r: 152, g: 54, b: 37 },
     { r: 204, g: 145, b: 138 },
     { r: 119, g: 38, b: 19 },
     { r: 115, g: 49, b: 7 },
     { r: 242, g: 216, b: 243 },
     { r: 152, g: 69, b: 35 },
     { r: 109, g: 53, b: 72 },
     { r: 118, g: 37, b: 6 },
     { r: 169, g: 56, b: 65 },
     { r: 107, g: 90, b: 67 },
     { r: 136, g: 37, b: 19 },
     { r: 53, g: 7, b: 0 },
     { r: 239, g: 103, b: 113 },
     { r: 103, g: 53, b: 52 },
     { r: 170, g: 46, b: 22 },
     { r: 56, g: 34, b: 6 },
     { r: 182, g: 86, b: 103 },
     { r: 152, g: 52, b: 21 },
     { r: 137, g: 104, b: 102 },
     { r: 152, g: 86, b: 70 },
     { r: 152, g: 119, b: 119 },
     { r: 184, g: 161, b: 208 },
     { r: 170, g: 85, b: 69 },
     { r: 152, g: 100, b: 44 },
     { r: 102, g: 50, b: 6 },
     { r: 151, g: 38, b: 21 },
     { r: 118, g: 55, b: 53 },
     { r: 244, g: 178, b: 139 },
     { r: 152, g: 85, b: 53 },
     { r: 254, g: 206, b: 168 },
     { r: 120, g: 87, b: 85 },
     { r: 139, g: 82, b: 109 },
     { r: 152, g: 86, b: 35 },
     { r: 151, g: 105, b: 102 },
     { r: 233, g: 107, b: 81 },
     { r: 73, g: 50, b: 19 },
     { r: 101, g: 39, b: 36 },
     ... 156 more items ],
  loopCount: 0,
  height: 400,
  width: 720,
  animated: true,
  images: 
   [ { identifier: '0',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '1',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '2',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '3',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '4',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '5',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '6',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '7',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '8',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '9',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '10',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '11',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '12',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '13',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '14',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '15',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '16',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '17',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '18',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '19',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '20',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '21',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '22',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '23',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 },
     { identifier: '24',
       localPalette: false,
       localPaletteSize: 0,
       interlace: false,
       comments: [],
       text: '',
       left: 0,
       top: 0,
       width: 720,
       height: 400,
       delay: 40,
       disposal: 1 } ],
  isBrowserDuration: true,
  duration: 1000,
  durationIE: 2500,
  durationSafari: 1000,
  durationFirefox: 1000,
  durationChrome: 1000,
  durationOpera: 1000 }

Resources

License

Licence: MIT