I have successfully created a image with the form of a square diamond by providing an original image and a masking image with background black alpha 0 and the diamond square white with alpha 1.
I use the following gm command
gm composite -compose in orgiginal.jpg diamond-mask.png result.png
Now I would like to reproduce the result using node.js gm module.