watermark(logo) in win batch

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
tomino
Posts: 1
Joined: 2015-03-16T06:04:49-07:00
Authentication code: 6789

watermark(logo) in win batch

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: watermark(logo) in win batch

Post 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?
snibgo's IM pages: im.snibgo.com
Post Reply