I'm trying to compose two images on top of each other using the Node.js gm library. For the final image, avatar.png
needs to go on top of bg.png
. Here's the code I started with:
const image = gm("bg.png")
.composite("avatar.png");
This works the way it should, but I also needed to move the image over to an x
, y
of 50
, 50
, so I used the geometry()
function:
const image = gm("bg.png")
.composite("avatar.png")
.geometry("+50+50");
The next problem is that I needed to scale the image up to be 200
x200
, so I tried a few things to do this:
const image = gm("bg.png")
.composite("avatar.png")
.geometry("200x200+50+50");
This ended up scaling bg.png
to be as close to 200
x200
as possible while still preserving the aspect ratio of the image. Since that didn't work, I tried this:
const image = gm("bg.png")
.composite("avatar.png")
.resize("200x200")
.geometry("+50+50");
This just ignored the resize()
function and didn't scale anything at all. Swapping the order of resize()
and geometry()
also didn't do anything.
How can I scale avatar.png
to be 200
x200
?