aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 615 forks source link

How to insert a image into a image #855

Open spelsinx opened 1 year ago

spelsinx commented 1 year ago

How to paste an image on an image and scale it like a canvas?

drawImage("image.png", 350, 450)
yellowjacketcoder commented 1 year ago

@spelsinx You need to create your own string and then pass it into draw like so:

.draw('image over x,y width,height "image.png"')

But yeah, a helper method would be nice, bonus points for adding support for directly passing the sub-image as a buffer/stream like it is supported for the base image, eliminating the need for storing sub-images to a temp directory at all

spelsinx commented 1 year ago

hello i used this text, it is in place, everything is fine

.drawText(440, 270, "spelsinx", 'southeast')

and this - leads the text forward, but I want it to be in place and not move.

.drawText(440, 270, "prop", 'southeast')

how to make the text not move, but stand still, as in the case of "spelsinx"?

@spelsinx You need to create your own string and then pass it into draw like so:

.draw('image over x,y width,height "image.png"')

But yeah, a helper method would be nice, bonus points for adding support for directly passing the sub-image as a buffer/stream like it is supported for the base image, eliminating the need for storing sub-images to a temp directory at all