Skip to content

Instantly share code, notes, and snippets.

@AdamMagaluk
Last active December 21, 2015 21:19
Show Gist options
  • Save AdamMagaluk/6367512 to your computer and use it in GitHub Desktop.
Save AdamMagaluk/6367512 to your computer and use it in GitHub Desktop.
Watermark Images Node.js
var exec = require('child_process').exec;
function watermark(base,marker,output,callback){
var command = [
'composite',
'-watermark', '1x1',
'-gravity', 'center',
'-quality', 100,
marker,
base,
output
];
exec(command.join(' '), function(err, stdout, stderr) {
return callback(err);
});
}
if(process.argv.length < 5){
console.log("Usage: <base> <marker> <output>");
return;
}
watermark(process.argv[2],process.argv[3],process.argv[4],function(err){
if(err)console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment