gif-tool
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

node-gif-tool

NPM
GitHub

About

WARNING! This module is maintaned by one person yet. Great maintenance is not guaranteed. There are some plans on it though

This module is mainly written in Rust and bound to NAPI using ffi-napi*. Image processing is implemented through image-rs/gif. Cross-platform builds are handled via cross

  • Easy to use
  • Declaration files included
  • Simple. Easy to learn

Installation

npm: npm i gif-tool
yarn: yarn add gif-tool
pnpm: pnpm add gif-tool

The binaries are built-in

Inspiration

The idea of this module is to make an ease to use and performant gif encoder/decoder. No absurd amount of huge functions

Examples

Could be found in examples/ folder

const { GifEncoder, GifDecoder } = require("gif-tool");
const { writeFileSync } = require("fs");

/* explode */
const decoder = new GifDecoder("mygif.gif");
let i = 0;
for (const frame of decoder.frames) {
  writeFileSync(`./frames/frame_rgba_uncompressed_${i}`, frame.buffer());
  i += 1;
}

// simple single-pixel RGBA frames
const frames = [
  // red
  255, 0, 0, 255,

  // green
  0, 255, 0, 255,

  // blue
  0, 0, 255, 255
];

/* merge */
const encoder = new GifEncoder();
encoder.setDelay(10);

frames.forEach(frame => encoder.writeFrame(frame));
writeFileSync("./out.gif", encoder.buffer());

It's that simple!

References:

Roadmap:

  • [ ] Compare current implementation with gifski
    • [ ] Migrate to gifski if needed
  • [ ] Handle more existing image processing methods
    • [ ] Get in use more existing options
  • [ ] Implement different image loading methods into GifDecoder, such as raw buffer. Currently only file path is supported
  • [ ] Built-in GIF manipulation functionality
  • [ ] Add some paragraphs to the roadmap. lol

Contributions are appreciated

Package Sidebar

Install

npm i gif-tool

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

15.6 kB

Total Files

8

Last publish

Collaborators

  • zargovv