https://github.com/aaharu/gifken
JavaScript library that can reverse and split animated GIFs
https://github.com/aaharu/gifken
animated-gif gif javascript nodejs typescript wasm
Last synced: about 2 months ago
JSON representation
JavaScript library that can reverse and split animated GIFs
- Host: GitHub
- URL: https://github.com/aaharu/gifken
- Owner: aaharu
- License: mit
- Created: 2013-09-23T02:48:41.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T18:39:46.000Z (about 1 year ago)
- Last Synced: 2025-03-26T01:01:51.370Z (2 months ago)
- Topics: animated-gif, gif, javascript, nodejs, typescript, wasm
- Language: Rust
- Homepage:
- Size: 1.8 MB
- Stars: 25
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gifken
[](https://www.npmjs.com/package/gifken) [](https://app.fossa.io/projects/git%2Bgithub.com%2Faaharu%2Fgifken?ref=badge_shield)
## How to use
### Split an animated GIF image in browser
```html
import {reverse, split} from 'gifken'
const imageUrl = '/01_Koch-Kurve-Sechseck-alt._Def.-2.gif'
const response = await fetch(imageUrl)
const buffer = await response.arrayBuffer()const results = await split(new Uint8Array(buffer))
for (const result of results) {
const img = new Image()
img.src = URL.createObjectURL(new Blob([result], {type: 'image/gif'}))
document.body.append(img)
}```
### Reverse an animated GIF image with Node.js
```javascript
const {readFileSync, writeFileSync} = require('fs')
const gifken = require('gifken')gifken
.reverse(readFileSync('./assets/01_Koch-Kurve-Sechseck-alt._Def.-2.gif'))
.then(result => {
writeFileSync('reverse.gif', result)
})
```## Build
To build gifken, following tools are required
- Node.js >=14
- npm >=8
- [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)
- wasm-bindgen```bash
git clone *thisrepo*
cd gifken
npm install
npm run build
```## Similar Projects
- [gif reverser](https://github.com/migerh/rustwasm-gif)
## License
MIT
[](https://app.fossa.io/projects/git%2Bgithub.com%2Faaharu%2Fgifken?ref=badge_large)