S
S
Stanislav2021-10-24 12:25:10
Node.js
Stanislav, 2021-10-24 12:25:10

How to center a watermark in GM if I don't know the width and height?

I have a photo and I need to put a second watermark on it
. I do it like this

gm( request.file.path ).selectFrame(0).draw([`image over 0,0 100,100 "${config.upload.path}/preload.png"`]).write(....

The image is superimposed in the upper left corner due to image over 0,0, but is it possible to specify that it is placed in the center?
The problem is that I create reduced copies in height, and here I have to write a bunch of crutches to calculate the location of watermarka in the form of width / 2-100 and height / 2-100, because besides this, some copies do not need to be reduced in height. Those. it can be done, but maybe GM itself knows how to center the second picture?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question