forked from aheckmann/gm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposite.js
32 lines (26 loc) · 853 Bytes
/
composite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// composite
var exec = require('child_process').exec;
var utils = require('./utils');
/**
* Composite images together using the `composite` command in graphicsmagick.
*
* gm('/path/to/image.jpg')
* .composite('/path/to/second_image.jpg')
* .geometry('+100+150')
* .write('/path/to/composite.png', function(err) {
* if(!err) console.log("Written composite image.");
* });
*
* @param {String} other Path to the image that contains the changes.
* @param {String} [mask] Path to the image with opacity informtion. Grayscale.
*/
module.exports = exports = function(proto) {
proto.composite = function(other, mask) {
this.in(other);
// If the mask is defined, add it to the output.
if(typeof mask !== "undefined")
this.out(mask);
this.subCommand("composite");
return this;
}
}