Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script that uses imagemagick to append a watermark to the bottom of each image in the given folder.
#!/bin/sh
# _ __ _ _____
# __ ______ (_)___ ___ ____ _/ /______(_) _/__ / _ _____ _________
# / / / / __ \/ / __ \__ \/ __ \/ __/ ___/ / |/_/ / / | |/_/ _ \/ ___/ __ \
# / /_/ / / / / / / / / / / /_/ / /_/ / / /> < / /___> </ __/ / / /_/ /
# \__,_/_/ /_/_/_/ /_/ /_/\__,_/\__/_/ /_/_/|_| /____/_/|_|\___/_/ \____/
#
# 2012-11-02
# Script to use imagemagick to append a watermark to the bottom of a folder of images.
#
# Usage:
#
# Copy the watermark.jpg you want to use into the folder where the images are.
# - works best if the image has a white background as that will be the default
# imagemagick uses to fill in the void
# - it will skip the watermark.jpg and .dotfiles in the folder
#
# Example:
# %> cd where_my_pics_at
# %> append_watermark.sh .
PREFIX=${PREFIX:-'photography'}
for i in `find $1`;
do
new_name="${PREFIX}_`echo \"$i\" | sed -e 's/.jpg//' | sed -e 's/\.\///'`.jpg"
if [[ $i == ./.* ]] || [[ $i == *watermark* ]] || [[ $i == . ]] || [[ $i == *$PREFIX* ]]; then
echo "Skipping ${i}"
else
echo "Appending watermark to: ${i} -> ${new_name}"
convert -append "$i" watermark.jpg "$new_name"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.