Skip to content

garbetjie/apng-assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APNG Assembler

Simple wrapper around the excellent APNG Assembler command line binary.

Usage

const Assembler = require('apng-assembler');

// Assemble file asynchronously.
Assembler.assemble(
    'input*.png',
    'output.png',
    {
        loopCount: 0,
        frameDelay: 100,
        compression: Assembler.COMPRESS_7ZIP
    }
).then(
    function(outputFile) {
        console.log(`${outputFile} has been assembled successfully.`);
    },
    function(error) {
        console.error(`Failed to assemble: ${error.message}`);
        console.error(`stdout: ${error.stdout}`);
        console.error(`stderr: ${error.stderr}`);
    }
);

// Assemble file synchronously.
try {
    Assembler.assembleSync(
        'input*.png',
        'output.png',
        {
            loopCount: 0,
            frameDelay: 100,
            compression: Assembler.COMPRESS_7ZIP
        }
    );
} catch (e) {
    console.error(`Failed to assemble: ${error.message}`);
    console.error(`stdout: ${error.stdout}`);
    console.error(`stderr: ${error.stderr}`);
}

// Pass an instance of the assembler around.
let assembler = new Assembler.Assembler(loopCount, frameDelay, compression);
assembler.assemble('input*.png', 'output.png');
assembler.assembleSync('input*.png', 'output.png');

Credits

About

A NodeJS wrapper library around the apngasm binary.

Resources

License

Stars

Watchers

Forks

Packages