jnordberg / gif.js

JavaScript GIF encoding library
http://jnordberg.github.io/gif.js/
MIT License
4.76k stars 668 forks source link

Breaking down gif.js into smaller modules #16

Closed twolfson closed 10 years ago

twolfson commented 10 years ago

This is less of an issue and more of a notice.

This weekend as part of Node Knockout, I implemented gifsockets in JavaScript.

http://console-log.2013.nodeknockout.com/

I started from gif.js for the GIF encoding but had to fork it significantly for stream-like behavior (it was a hackathon after all) and performance.

I want to formalize the work and edits for gifsockets into the appropriate node modules. As a result, each class (e.g. GifEncoder, TypedNeuQuant, LZWEncoder) will need to become its own repo and node module.

I would not be opposed to collaborating but I think this is following a different direction than gif.js which is more targeted at the browser.

max-mapper commented 10 years ago

+100, and it would also be rad if gif.js was on NPM for easy usage with things like browserify.

The point @twolfson brought up in the last line about gif.js targeting the browser is not a mutually exclusive feature from being modular -- you just need a build step that combines the gif.js components into a distributable gif.js file.

jnordberg commented 10 years ago

Yeah wouldn't be a problem at all. I actually have a package.json and the dist js is already bundled using commonjs-everywhere.

I'll slap together an index file and publish it. And if you want to maintain separate packages for the classes i'd be happy to move them out of gif.js core and just depend on them via npm instead.

jnordberg commented 10 years ago

re browserify and the likes: anyone have an idea on how to load the worker script? I've added a browser field to the package.json but you'll still need to include the worker file somewhere on your page.

twolfson commented 10 years ago

@jnordberg I think the browserify question would be best suited for irc.freenode.net/#browserify

@maxogden I started breaking out the raw GIFEncoder last night. During the hackathon, I went with a streams-like API (data/end EventEmitter) but I should have a working streams2 implementation done tonight.

https://npmjs.org/package/gif-encoder

twolfson commented 10 years ago

@maxogden gif-encoder has moved to readable-stream for streams1/streams2 functionality in 0.3.0. Additionally, it is now well documented and has tests.

jnordberg commented 10 years ago

Had a look at your module, and it does not seem to do anything but replace the ByteArray implementation for a node stream. Closing this, feel free to reopen if you actually break out the modules in to separate packages - and make them both node and browser compatible of course. Cheers