Page 1 of 1

Multiple watermarking in one command line with "composite" c

Posted: 2007-07-25T07:42:52-07:00
by willie
Hi,

I got a directory which contains my watermarkimage and a couple of images which I want to watermark.

$ ls
img_5439-0.jpg img_5439-1.jpg img_5439-2.jpg img_5439-3.jpg img_5439-4.jpg img_5439-5.jpg img_5439-6.jpg img_5439-7.jpg watermark.gif

It works great when I am doing only one image at the time, see:

composite -dissolve 20% -gravity SouthEast -geometry -50+35 watermark.gif input.jpg output.jpg

But what I need is having input equal *.jpg

I tried:
composite -dissolve 20% -gravity SouthEast -geometry -50+35 watermark.gif *.jpg
composite -dissolve 20% -gravity SouthEast -geometry -50+35 watermark.gif *.jpg *.jpg
composite -dissolve 20% -gravity SouthEast -geometry -50+35 watermark.gif *

but it ain't work.

Do I actually need to write a shell script for the loop or is there an easy way for my problem ?

Thanks.

Regards

Re: Multiple watermarking in one command line with "composite" c

Posted: 2007-07-25T09:17:08-07:00
by brian_jackson
Yes, you're going to want to write a little for loop to do this. The syntax you're trying to use looks rather DOSish :)

for i in *jpg; do
composite -dissolve 20% -gravity SouthEast -geometry -50+35 watermark.gif $i out_$i
done

you can change whatever you want the output to be, I just happened to prepend 'out_' to the beginning of the filename, to preserve the original file, you can do all sorts of things.

for example, if you want to change 'img' to 'wm' do this:
wm${i#img} as your outfile will rename img_5439-0.jpg wm_5439-0.jpg

Oh, all this assuming your're running bash.

good luck,
brian

Re: Multiple watermarking in one command line with "composite" c

Posted: 2007-07-25T11:37:49-07:00
by willie
Many Thanks !

Regards