Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaelzhang/node-gifx
🔥 A native node.js bindings to the giflib, and provides useful APIs.
https://github.com/kaelzhang/node-gifx
bindings giflib image image-processing nodejs
Last synced: about 2 months ago
JSON representation
🔥 A native node.js bindings to the giflib, and provides useful APIs.
- Host: GitHub
- URL: https://github.com/kaelzhang/node-gifx
- Owner: kaelzhang
- Created: 2017-12-12T10:53:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-14T03:08:44.000Z (about 7 years ago)
- Last Synced: 2024-12-06T05:16:26.943Z (about 2 months ago)
- Topics: bindings, giflib, image, image-processing, nodejs
- Language: C
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gifx
CURRENTLY STILL WORKING IN PROGRESS, DO NOT USE.
The GIF maker, reader and mangler, which is a native node.js bindings to the giflib.
## install
```sh
$ npm i gifx
```## Usage
```js
import Gifx from 'gifx'const catBuffer = fs.readFileSync(filepathCat)
const dogBuffer = fs.readFileSync(filepathDog)// Creates a new 300x200(square pixels) stage
new Gifx(300, 200).background('#ffffff') // Sets the background color to '#ffffff',
// default to transparent).unit(500) // Sets the unit time to 500 ms,
// i.e. each frame will last 500 ms
.layer()
.start(0) // Starts from the first frame.
// The index of a frame begins with 0..duration(2) // The duration is 1 second
.add(catBuffer) // Adds a cat
.leave() // Returns to the stage
.layer()
.start(2)
.end(5) // Ends before (and NOT INCLUDES) the frame of
// index 5 (the fifth frame)
// which has the same effect with `.duration(3)`.add(dogBuffer, { // Adds a dog with a x-axis offset of 150
x: 150,
y: 0
})
.leave()
.repeat(0) // Repeat infinitely
.stream() // Creates a readable stream and write to file.
.pipe(fs.createWriteStream('cat-and-dog.gif'))
```# new Gifx(width, height)
## gif.unit(milliseconds = 1)
- **milliseconds** `number=1`
Returns `this`
## gif.layer()
Returns `Layer`
## gif.repeat(repeat)
- **repeat** `number | boolean`
- `0 | true`: infinite loop
- `1 | false`: no repeat
- other number, `3` for example: plays 3 timesReturns `gif`
## gif.stream()
Returns `Stream.Readable`
# Layer
## layer.start(start)
- **start** `number` the
## layer.duration(duration)
## layer.end(end)
## layer.leave()
Returns `Gifx`