I have two single images, background.png and tree.png. I'd like to place the tree.png on top of my background.png at (150, 150 ) while resizing the tree.png to specific 100x300px. Here is what I've been able to do so far:
gm = require( 'gm' );
gm()
.in( '-page', '+0+0' )
.in( 'public\\media\\background.png' ) //Load the background
.in( '-page', '+150+150' ) //X and Y position of the tree
.in( 'public\\media\\tree.png' )
.mosaic()
.write( 'result.png', function (err) {
if ( !err ) console.log( err )
});
I am able to produce the the picture that contains the tree on top of the background at specifically 150 150. However, I don't know how to resize the tree.png to 100x300px. Please advise.
Also, is this the correct way of merging 2 layers? I did a lot of research and this one turned out to be the only one that worked for me. I'd like to hear your opinions.
Thank you so much.