var gm = require('gm');
gm()
.in('-page', '+0+0') // Custom place for each of the images
.in('a.jpg')
.in('-page', '+256+0')
.in('b.jpg')
.minify() // Halves the size, 512x512 -> 256x256
.mosaic() // Merges the images as a matrix
.write('output.jpg', function (err) {
if (err) console.log(err);
});
var gm = require('gm');
gm()