Page 1 of 1

Overlaid Watermark larger than overlaying image

Posted: 2017-05-02T02:39:57-07:00
by ceodecasteo
Hi,
i have a question related to the image composition.

I have a watermark.jpg with dimension 1649 × 100 pixels.
First I reduce it to 50%, so the new dimensions are 824 x 50 pixels; then I use it as watermark for other images.

There are two cases:
(i) An image A with width's dimension greater than 824:
there is no problem, the watermark is enterely displayed.

(ii) An image B with width's dimension lower than 824.
In this case I have a problem: the watermark is truncated.
Otherwise the image B should be enlarged (in width direction) in order to display the watermark.
Is possibile to achieve this goal? I try with some combinations of resize, but I can't be able ...

My command is like that:

convert image_A.jpg -resize 1181x1181\
\( watermark.png -resize 50%x50% \) -gravity South -geometry +0+80 -composite\
image_A_with_watermark.jpg

Thank you in advance,
Alessandro

Re: Overlaid Watermark larger than overlaying image

Posted: 2017-05-02T04:54:54-07:00
by snibgo
It can be done in a single command, but it's a bit messy.

Personally, I'd do it in a script:

1. Resize the image and get its dimensions.
2. Resize the watermark and get its dimensions. (But isn't this constant? So no need to repeat it?)
3. If the image is too narrow, stretch it.
4. Apply the watermark.

Re: Overlaid Watermark larger than overlaying image

Posted: 2017-05-03T00:56:55-07:00
by ceodecasteo
Thank you very much for your suggestions.
Alessandro