2. Batch processing

If you’re not afraid to use the terminal, then it is very easy to apply a watermark to tens or hundreds of photos using ImageMagick.

mr.imagemagick.himself

On decent operating systems the package ImageMagick is installed by default. You can check if that’s the case by opening a terminal window and typing one of the many commands of this Swiss army knife for imaging, for example ‘convert’. If you see many options passing, it is installed. If not, get it from the main page of this open source project. Apart from Linux it runs on Windows, Mac OSX, iOS and Android, among others.

You have already prepared the watermark image in the form of a png file as described in the first article in this series. If not, you can use any logo you want, as long as it fits the photos to be watermarked.

Collect the photos to be watermarked in a new folder. Open a terminal window and navigate to the folder with your photos. Then type the following:

for i in *.jpg *.JPG; do echo $i; composite -gravity south-east my.watermark.png $i wm.$i; done

(Note: this is one line).

This says:
– take files ending on jpg and JPG in the current folder
– use the composite command that is part of the ImageMagick toolbox to overlay the file my.watermark.png on those jpg’s or JPG’s
– use the -gravity switch to say where the watermark must be placed; north, south, east or west and their intermediate directions/places: south-east, etc.
– write ‘wm.’ in front of the file name to indicate that it is watermarked.

Note that the original files will not be overwritten.

If you want to add more commands – a resize for example – then it’s better to place this text in a little script, like so.

for i in *jpg *JPG
 do
 composite -gravity south-east my.watermark.png $i wm.$i
done

Give it a name like watermark.sh. Make it executable by typing ‘chmod +x watermark.sh’ in the terminal or select the file in a file manager, hit Alt+Enter for Properties, click tab Rights and check the box before ‘Allow this program to be executed’. Run by typing ./watermark.sh.

hor.bar
pm|jan16

Advertisements
%d bloggers like this: