Page 1 of 1

watermark(logo) in win batch

Posted: 2015-03-16T07:10:43-07:00
by tomino
Hello,

I'm trying to improve my current simple batch for watermark JPGs. Now I'm able to watermark all files in dir, watermarked files store in subdir with suffix. But I'm not satisfied with watermarking different size or orientation of original files.

Now I have this in FOR loop:

Code: Select all

composite ( logo_transparent.png -resize 15%% -gravity SouthEast -geometry +60+20 ) %1 Logo\%~n1_logo.jpg
I'm looking for help with improving this batch to resizing watermark/logo "on-the-fly" depending on original files' size or orientation (landscape, portrait)

So is there way how to do this better?
Im working on Windows 7 64b, with IM 6.9.0 Q16

Thanks

Re: watermark(logo) in win batch

Posted: 2015-03-16T13:01:55-07:00
by snibgo
You can get the width and height into environment variables WW and HH like this (Windows BAT syntax):

Code: Select all

for /F "usebackq" %%L in (`%IM%identify -format "WW=%%w\nHH=%%h" %SRC%`) do set %%L
Then your script can make decisions based on the dimensions.

Does that help?