@ibaraki-douji/anime4k-gif

1.0.0 • Public • Published

Anime4k GIF

A simple GIF upscaler using anime-4k-cpp
And my other lib anime4k

Getting started

npm i @ibaraki-douji/anime4k-gif --save

Usage

Import the lib

const anime4kgif = require('@ibaraki-douji/anime4k-gif')

Start Upscale

const anime4kgif = require('@ibaraki-douji/anime4k-gif')

const input = "./path/to/gif";
//const input = readFileSync('./path/to/gif'); // <- Buffer
const output = "./path/to/upscaled/gif";
//const output = "" // <- IF BufferOutput Option

const options = {
    /**
     * Threads
     * -t
     */
    threads: 16,
    /**
     * Upscale Multiplier
     * -z
     */
    scale: 2,
    /**
     * Choose GPU
     * -q
     */
    gpu: true,

    outputAsBuffer: true
}

anime4kgif.upscale(input, output, options);

Wait the end

const anime4kgif = require('@ibaraki-douji/anime4k-gif')
const upscale = anime4kgif.upscale(input, output, options);

upscale.finishedPromise().then(() => {
    console.log("Finished")
})

Get Buffer at End

const anime4kgif = require('@ibaraki-douji/anime4k-gif')
const upscale = anime4kgif.upscale(input, output, options);

upscale.finishedPromise().then(() => {
    writeFileSync("./buffer.gif", upscale.endBuffer);
})

List yours GPUs

const anime4kgif = require('@ibaraki-douji/anime4k-gif')
anime4kgif.listGPUs().then(console.log)

Exemple

const anime4kgif = require('@ibaraki-douji/anime4k-gif')
// npm i axios
const axios = require('axios').default

// MAKE A ASYNC FUNCTION AT START
(async () => {
    const upscale = anime4kgif.upscale((await axios.get('https://cdn.discordapp.com/attachments/770019121349001227/874597329594892338/in.gif')).data, "./output.gif", {
        upscale: 2,
        noise: 0
    });
    await upscale.finishedPromise()
    console.log("Finished");
})()

More Help and Support

Discord : https://discord.gg/mD9c4zP4Er

Ask me what you want in the Discord server

Dependencies (2)

Dev Dependencies (3)

Package Sidebar

Install

npm i @ibaraki-douji/anime4k-gif

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

9.73 kB

Total Files

13

Last publish

Collaborators

  • ibaraki-douji