GIF Encoder for Node JS that tries to have reasonable performance.
yarn add @tyrone-sudeium/napi-gif-encoder
| Linux x64/aarch64 | macOS x64/aarch64 | Windows x64 |
|---|---|---|
| ✓ | ✓ | ✓ |
Theoretically, any version of Node.js that supports N-API should work. The CI is validated against LTS versions of Node:
| Node 12 | Node14 |
|---|---|
| ✓ | ✓ |
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.
- Install latest
Rust. Suggest using rustup. - Install
NodeJS@10+. LTS versions suggested. Any version supportingN-APIshould work. - Install
[email protected].
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.
yarnyarn buildcd sampleyarnnode index.js
You'll then see output.gif, which was encoded using the rust encoder.
Using a Ryzen 3950X to encode the sample project:
| Encoder | Time |
|---|---|
gif-encoder-2 |
787ms |
napi-gif-encoder |
217ms |