gif-frame-reducer
v0.1.0
Published
Node js plugin to reduce gif file size by deleting frames
Downloads
19
Readme
gif-frame-reducer
Nodejs plugin to reduce gif frames by Gifsicle
Install
$ npm install gif-frame-reducer
Usage
const gifFrameReducer = require("gif-frame-reducer");
const fs = require("fs");
const buf = fs.readFileSync("avocado.gif");
gifFrameReducer({
width: 200,
max_frame: 10,
})(buf).then((data) => {
console.log("'data' contains processed GIF.");
});
API
gifResize([options])(buffer)
Returns a promise for a buffer.
options
Type: Object
width
Type: number
Resize GIF to given width in pixels. It maintains aspect ratio.
height
Type: number
Resize GIF to given height in pixels. It maintains aspect ratio.
stretch
Type: boolean
If this is set, and width
and height
both are provided, the GIF will be resized such that it exactly matches the dimensions provided. It won't match the aspect ratio.
timeout
Type: number
Default: 0
This is process timeout in milliseconds. If set to positive number, it will throw timeout error after that many milliseconds.
max_frame
Type: number
Default: null
max_delay
Type: number
Default: null
License
MIT