Tips & Tricks‎ > ‎

How I watermark my photo's

posted 4 Nov 2014, 04:45 by Tony Wouters
In case you wonder how I watermark my photo's before I put them on google plus, well this is how:

you'll need:
As I'm an Ubuntu user I have my script in shell script. For windows users... euh, well you'll need to create your own .cmd or .bat file (Or buy some fancy expensive program)

The script as I use it needs to be run in the directory where the JPG files are located, and it converts .JPG files only, not .jpg files (windows users: yes, this does makes a difference)

The code:
for IN in *.JPG
echo "convert "${IN}" to "${OUT}
# This line will resize the image and add a border to it.
convert ${IN} -auto-orient -resize "2000>x2000>" \( +clone -background black -shadow 90x10+20+20 \) +swap -background white -layers merge +repage -resize "2000>x2000>" -bordercolor white -border 8 ${OUTt}
ww=`convert ${OUTt} -format "%[fx:.06*w]" info:`
hh=`convert ${OUTt} -format "%[fx:.06*h]" info:`
# Following line will create a post-it like watermark and rotate it in a random angle Size is based on the size of out photo
convert ${WATERMARK} -resize ${ww}x${hh} -bordercolor yellow -background black +polaroid "/tmp/watermark.png"
ww=`convert ${OUTt} -format "%[fx:.12*w]" info:`
hh=`convert ${OUTt} -format "%[fx:.12*h]" info:`
# resize our second watermark
convert ${WATERMARK2} -resize ${ww}x${hh} "/tmp/watermark2.png"
# Add the watermarks to the photo
composite -dissolve 65% -gravity southeast -geometry +60+60 \( "/tmp/watermark2.png" \) ${OUTt} ${OUTt2}
composite -gravity northwest -geometry +60+60 \( "/tmp/watermark.png" \) ${OUTt2} ${OUT}
# Clean-up
rm ${OUTt} ${OUTt2}
rm /tmp/watermark.png /tmp/watermark2.png