Giter Club home page Giter Club logo

gify's Introduction

gify

JavaScript API for decoding/parsing information from animated GIFs using ArrayBuffers.

Why?

Once I saw vinepeek, I immediately wanted to build a similar site for animated GIFs. The only problem was, there was no way to quickly determine the duration of an animated GIF, which varies in different browsers. Thus, gify was born over a weekend.

Requirements

gify requires jDataView for reading binary files. Please pull the latest from their repository.

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 (50fps)
  • 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

  • identifier (string) - Image identifier (frame number or embeded string).
  • 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.
  • text (string) - frame text. aka Plain Text Extension.
  • comments ([comments]) - Array of comment strings.
  • disposal (int) - Disposal method. (0-7). See this for more details.

Example

{
  "valid": true,
  "globalPalette": true,
  "globalPaletteSize": 256,
  "globalPaletteColorsRGB": [
    {
      "r": 50,
      "g": 82,
      "b": 120
    },
    {
      "r": 89,
      "g": 105,
      "b": 119
    },
    {
      "r": 4,
      "g": 33,
      "b": 71
    }
  ],
  "loopCount": 0,
  "height": 1610,
  "width": 899,
  "animated": true,
  "images": [
    {
      "identifier": "0",
      "localPalette": false,
      "localPaletteSize": 0,
      "interlace": false,
      "comments": [],
      "text": "",
      "left": 0,
      "top": 0,
      "width": 1610,
      "height": 899,
      "delay": 350,
      "disposal": 0
    },
    {
      "identifier": "1",
      "localPalette": true,
      "localPaletteSize": 256,
      "interlace": false,
      "comments": [],
      "text": "",
      "left": 0,
      "top": 0,
      "width": 1610,
      "height": 899,
      "delay": 350,
      "disposal": 0
    },
    {
      "identifier": "2",
      "localPalette": true,
      "localPaletteSize": 256,
      "interlace": false,
      "comments": [],
      "text": "",
      "left": 0,
      "top": 0,
      "width": 1610,
      "height": 899,
      "delay": 350,
      "disposal": 0
    },
    {
      "identifier": "3",
      "localPalette": true,
      "localPaletteSize": 256,
      "interlace": false,
      "comments": [],
      "text": "",
      "left": 0,
      "top": 0,
      "width": 1610,
      "height": 899,
      "delay": 350,
      "disposal": 0
    }
  ],
  "isBrowserDuration": false,
  "duration": 2800,
  "durationIE": 2800,
  "durationSafari": 2800,
  "durationFirefox": 2800,
  "durationChrome": 2800,
  "durationOpera": 2800
}

Resources

gify's People

Contributors

rfrench avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.