I have four 256x256 px images: a.jpg, b.jpg, c.jpg and d.jpg. I would like to merge them together to produce 2x2 mosaic image. The resulting image should be also 256x256 px.
Like this:
+---+---+
| a | b |
+---+---+
| c | d |
+---+---+
Using plain GraphicsMagick and command line this can be done with
gm convert -background black \
-page +0+0 a.jpg \
-page +256+0 b.jpg \
-page +0+256 c.jpg \
-page +256+256 d.jpg \
-minify \
-mosaic output.jpg
But the problem is, how to do this using GraphicsMagick within Node.js?
gm('a.jpg')
.append('b.jpg')
.append('c.jpg')
.append('d.jpg')
.write('output.jpg', function (err) {})
// Produces 1x4 mosaic with dimensions 256x1024 px, not what I wanted