Skip to content

Instantly share code, notes, and snippets.

@jaymzcd
Created April 25, 2013 09:48
Show Gist options
  • Select an option

  • Save jaymzcd/5458693 to your computer and use it in GitHub Desktop.

Select an option

Save jaymzcd/5458693 to your computer and use it in GitHub Desktop.
Nice and easy watermarking with imagemagick on a directory with a given mask
#!/bin/bash
# _ _____ ________________ __ ______ ____ __ __
# | | / / |/_ __/ ____/ __ \/ |/ / | / __ \/ //_/
# | | /| / / /| | / / / __/ / /_/ / /|_/ / /| | / /_/ / ,<
# | |/ |/ / ___ |/ / / /___/ _, _/ / / / ___ |/ _, _/ /| |
# |__/|__/_/ |_/_/ /_____/_/ |_/_/ /_/_/ |_/_/ |_/_/ |_|
OUTDIR=${3:-/tmp}
MASK=${2:-mask.png}
# Set field separtor to ignore spaces in files when expanding
IFS=$(echo -en "\n\b");
echo "Using $MASK and outputing to $OUTDIR";
for file in $1/*; do
echo "Watermarking $file";
composite -gravity center $MASK "$file" $OUTDIR/`basename $file`;
done
unset $IFS;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment