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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gif-transparency

v2.0.0

Published

Javascript library for creating animated GIFs with transparency.

Readme

gif-transparency NPM Version

A Javascript library for creating animated GIFs with transparency

Based off of Animated_GIF by sole

(I modified a bit too much in my fork)

How to use it?

Include dist/Animated_GIF.js in your HTML.

var imgs = document.querySelectorAll('img')

var ag = new Animated_GIF.default()
ag.setSize(320, 240)

for (var i = 0; i < imgs.length; i++) {
  ag.addFrame(imgs[i])
}

var animatedImage = document.createElement('img')

// This is asynchronous, rendered with WebWorkers
ag.getBase64GIF(function (image) {
  animatedImage.src = image
  document.body.appendChild(animatedImage)
})

If you instance lots of Animated_GIF objects, it's strongly recommended that you call their destroy method once you're done rendering the GIFs, as browsers don't seem to be happy otherwise. See the stress test for an example of this in use!

Using from npm

You can also use this via npm.

To install:

npm install --save gif-transparency

To use:

var Animated_GIF = require('gif-transparency')

// And then the examples are as before
var ag = new Animated_GIF()
ag.setSize(320, 240)

// ... etc

Available options

Pass an object with the desired values when creating an Animated_GIF instance:

  • numWorkers (number) {2}: how many web workers to use. Default is 2.
  • dithering (string) {undefined}: selects how to best spread the error in colour mapping, to conceal the fact that we're using a palette and not true color. Note that using this option automatically disables the aforementioned quantizer. Best results if you pass in a palette, but if not we'll create one using the colours in the first frame. Possible options:
    • 'nearest'
    • 'riemersma'
    • 'floyd-steinberg'
    • 'false-floyd-steinberg'
    • 'stucki'
    • 'atkinson'
    • 'jarvis'
    • 'burkes'
    • 'sierra'
    • 'two-sierra'
    • 'sierra-lite'
  • palette (Array) {undefined}: An array of integers containing a palette. E.g. [ 0xFF0000, 0x00FF00, 0x0000FF, 0x000000 ] contains red, green, blue and black. The length of a palette must be a power of 2, and contain between 2 and 256 colours.

Tests and examples

Check the files in the tests folder:

Contributing / walkthrough

Here's a quick walkthrough of each of the files in src/ and what they do:

  • Animated_GIF.js - definition of the Animated_GIF class. Holds the logic for the queueing and rendering of the files, and parsing config options.
  • Animated_GIF.worker.js - code for the web worker that color-indexes frames in the background, using image-q. This is bundled in dist/Animated_GIF.js, using worker-loader.

Development

Start the server by running:

npm run development

Starts a server at http://localhost:9000/. It watchs for changes in the source files and rebuilds/reloads automatically.

Rebuild dist files

If you made changes in the library, you'll need to rebuild the files in dist/ and docs/dist in order to see the changes working on master.

Once node.js is installed in your system, do:

cd gif-transparency     # or however you cloned the library to
npm install         # this pulls dependencies for building
npm run build       # builds dist/
npm run development # started the dev environment (watch task) and builds docs/dist (a development version of the library)

Once you do the initial two steps you just need to execute npm run build whenever you change things and want to rebuild the files in dist/.

Breaking Changes

2.0.0

  • Removed window export of Animated_GIF

Credits

We're using these fantastic libraries to do GIF stuff: