Last active
December 21, 2015 21:19
-
-
Save AdamMagaluk/6367512 to your computer and use it in GitHub Desktop.
Watermark Images Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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