apng-assembler
v1.0.2
Published
Simple wrapper around the apngasm command line binary.
Downloads
6
Readme
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
- APNG Assembler by Max Stepin.