/home/ak/projects/watermarking-batch-scripts/
» Menu
Blog
Information
Photography
Projects
» Show project list
» Tags
Articles
» Latest photo
Thunderstorm, 20100808-_AK00278

[See all]
» My latest @ Flickr
Thunderstorm, 20100808-_AK00278 Thunderstorm, 20100808-_AK00252
Thunderstorm, 20100808-_AK00157 Thunderstorm, 20100808-_AK00301
» My latest @ YouTube
» Control board for a ...
» 5DmkII macro video test
» Tangband W4-657SC te...
» Kitty looking around...
» Robot arm - first test
» RSS-feeds
» Blog
» Projects
» Links
» Metku.net
» Teknolelu  FI
» Suomikuva  FI
» Valotuli  FI
 
Valid HTML 4.01!
Valid CSS!
Get Firefox!

© Aki Korhonen





 


Watermarking Scripts


If you need to add a watermark to a bunch of photos, these little scripts come in handy. You'll need a command line tool from ImageMagick called composite.

You'll need a watermark image somewhere, eg. C:\watermark.png or ~/watermark.png (/home/user/watermark.png) for Linux. Change the full path to the appropriate place if needed. You can also change the prefix (w_ by default) for the watermarked images. The script goes through all the JPG files in the directory that is given as a parameter and adds the watermark image to the location given and with an opacity of 45%.

For Windows, put it in a file like add_watermark.bat.
Usage:
add_watermark.bat "C:\location_to_photos\"

@echo off

set wm_image=C:\watermark.png
set out_prefix=w_
set wm_location=southeast

set input_directory=%1
cd /d %input_directory%

for /f %%a in ('dir /b *.jpg') do call :ADDSTAMP %%a
goto :eof

:ADDSTAMP
set file=%1
echo Making watermarked image %out_prefix%%file% from %file%
composite -dissolve 45 -gravity %wm_location% %wm_image% %file% %out_prefix%%file%

For Linux, put it in a file like add_watermark.sh.
Usage:
./add_watermark.sh /home/user/location_to_photos/

#!/bin/sh

wm_image=~/watermark.png
out_prefix=w_
wm_location=southeast

input_directory=$1
cd $input_directory

for file in *.jpg
do
 echo Making watermarked image $out_prefix$file from $file
 composite -dissolve 45 -gravity $wm_location $wm_image $file $out_prefix$file
done

The output on both should be something like this:
Making watermarked image w_image1.jpg from image1.jpg
Making watermarked image w_image2.jpg from image2.jpg

Usage on your own risk, I don't provide any support for these. I just made them for my own use and they work for me.