0.0.3 • Published 1 year ago

@gomander/napi-gif-encoder v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

napi-gif-encoder

https://github.com/gomander/napi-gif-encoder/actions

GIF Encoder for Node JS that tries to have reasonable performance.

This library is a fork of @tyrone-sudeium/napi-gif-encoder.
I made this fork because the original is not currently being maintained.

Install

npm install @gomander/napi-gif-encoder

Support matrix

Operating Systems

Linux x64/aarch64macOS x64/aarch64Windows x64

NodeJS

Theoretically, any version of Node.js that supports N-API should work. The CI is validated against LTS versions of Node:

Node 18Node 20

Building

If you are using this as a dependency, since we use N-API, you don't need to build anything! However, if you want to tinker with this code or submit a PR, read below.

Developing

  • Install latest Rust. Suggest using rustup. If on Windows, use WSL for an easier time.
  • Install NodeJS@20+. LTS versions suggested.
  • Install yarn@1.x.

You can then compile the rust code with:

yarn build

After yarn build/npm run build command, you can see napi-gif-encoder.[darwin|win32|linux].node file in project root. This is the native addon built from lib.rs.

Try out using sample project

  • yarn
  • yarn build
  • cd sample
  • yarn
  • node .

You'll then see output.gif, which was encoded using the rust encoder.

You can compare this to a Node-based GIF encoder by running node . --js.

Performance

This data is a ten-run average of the time it took to encode the sample project on a Ryzen 7 7800X3D.
Historical data from the original author also suggests that this library scales better with more cores than Node-based GIF encoders.

EncoderTime
gif-encoder-2692ms
napi-gif-encoder250ms

Todo

  • Add tests
0.0.3

1 year ago

0.0.2

1 year ago