node.js - How to add images in a loop with gm montage function? -
i want combine several images in grid. how can accomplish following without knowing image paths beforehand?
gm('/path/to/image.jpg') .montage('/path/to/second_image.jpg') .montage('/path/to/third_image.jpg') .geometry('+100+150') .write('/path/to/montage.png', function(err) { if(!err) console.log("written montage image."); }); lets image pathes available in array:
paths=['/path/to/image.jpg', '/path/to/second_image.jpg', '/path/to/third_image.jpg');
hm. did not use module, d do,
var g = gm('/path/to/image.jpg'); paths.foreach(function(p){ g.montage(p); }); g.geometry('+100+150') .write('/path/to/montage.png', function(err) { if(!err) console.log("written montage image."); }); no ?
Comments
Post a Comment