Page 1 of 1

Watermark size should depend on original size

Posted: 2012-09-13T05:29:56-07:00
by sven.fischer.de
Hi,

could you please tell me the solutions for resizing the watermark to a fixed percentance of the size of the original picture. All solutions I have found just resized the watermark ignoring the dependance.

So this I what I found, but how to modify it:

Code: Select all

composite  -gravity southeast  \( Watermark.png -resize 25% \) original-image.jpg
Target: Watermark size should always be 25% of the original picture.

Re: Watermark size should depend on original size

Posted: 2012-09-13T09:34:30-07:00
by fmw42
composite -gravity southeast \( Watermark.png -resize 25% \) original-image.jpg
There is no specified output image in your command.


In IM 6, you must find the size of the background image first with some variables. Then compute 25% of them. Then feed that to your -resize.

In unix,

ww=`convert backgroundimage -format "%[fx:.25*w]" info:`
hh=`convert backgroundimage -format "%[fx:.25*h]" info:`
composite -gravity southeast \( Watermark.png -resize ${ww}x${hh} \) original-image.jpg resultimage.jpg

I believe that what you want will be doable in IM 7 which is under alpha development right now. But Anthony can explain further.

Re: Watermark size should depend on original size

Posted: 2012-09-13T22:21:20-07:00
by anthony
IN IMv7 you can do this in the one command. But it is not complete, working, but not complete.

Re: Watermark size should depend on original size

Posted: 2012-09-14T02:31:05-07:00
by sven.fischer.de
Thanks guys for your help, the script works perfect!

Additional I'm happy to hear that it will be implementet in future versions, as (in my opinion) it's very important for running a wiki for example. Users upload different picture sizes and the watermark should depend on percentence size of course.

Thanks also for programming the swiss-army-knife tool.

Cheers from Germany,

Sven