Giter Club home page Giter Club logo

gifski-command's Introduction

Gifski Command

Node.js module for gifski GIF encoder CLI

NPM

NPM Version Coverage Status license Donate to this project using Paypal

Getting started

To get started with this library, you need to install it and add it to your project.

Installation

# npm
npm install gifski-command --save

# yarn
yarn add gifski-command

Library Usage

API Reference available at https://pichillilorenzo.github.io/gifski-command/.

import * as path from 'path';
import {GifskiCommand} from 'gifski-command';
// or
const path = require('path');
const {GifskiCommand} = require('gifski-command');

const command = new GifskiCommand({
  output: path.join(__dirname, 'test', 'video.gif'),
  frames: [ path.join(__dirname, 'test', 'video.mp4.frame*.png') ],
  quality: 100
});
command.on('progress', progress => {
  console.log(progress);
});
const result = await command.run();

CLI Usage

  • <pattern> represents a glob pattern used to specify PNG frames used by gifski. Surround the glob pattern with quotes (example './test/**/*.png').
  • [options] are the same as the gifski CLI options.
Usage: gifski-command [options] <pattern>

Examples: 
  gifski-command -Q 100 -o './test/video.gif' './test/**/video.mp4.frame*.png'
  gifski-command -o - './test/**/video.mp4.frame*.png' > './test/video.gif'

Arguments:
  pattern                Glob pattern of PNG image files. Surround the glob pattern with quotes (example './test/**/*.png').

Options:
  -o, --output <a.gif>   Destination file to write to; "-" means stdout
  -r, --fps <num>        Frame rate of animation. This means the speed, as all frames are kept. [default: 20]
  --fast                 50% faster encoding, but 10% worse quality and larger file size
  --extra                50% slower encoding, but 1% better quality
  -Q, --quality <1-100>  Lower quality may give smaller file [default: 90]
  -W, --width <px>       Maximum width. By default anims are limited to about 800x600
  -H, --height <px>      Maximum height (stretches if the width is also set)
  --no-sort              Use files exactly in the order given, rather than sorted
  -q, --quiet            Do not display anything on standard output/console
  --repeat <num>         Number of times the animation is repeated (-1 none, 0 forever or <value> repetitions)
  -h, --help             display help for command

CLI Usage Example

The recommended way is to first export video as PNG frames. If you have ffmpeg installed, you can run in terminal:

ffmpeg -i ./test/video.mp4 ./test/video.mp4.frame%04d.png

and then make the GIF from the frames:

gifski-command -Q 100 -o './test/video.gif' './test/**/video.mp4.frame*.png'

This code snippet shows how to put into action gifski-command to convert video frames into a high quality GIF using the gifski encoder.

Contributors

Any contribution is appreciated. You can get started with the steps below:

  1. Fork this repository (learn how to do this here).

  2. Clone the forked repository.

  3. Make your changes and create a pull request (learn how to do this).

  4. I will attend to your pull request and provide some feedback.

License

This repository is licensed under the ISC License.

gifski-command's People

Contributors

pichillilorenzo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mxmul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.