Skip to content

Instantly share code, notes, and snippets.

@jdeagle
Forked from dcrck/watermark.sh
Created May 5, 2020 22:51
Show Gist options
  • Save jdeagle/10c74e18a01c9dfbe5c98b49d44dc309 to your computer and use it in GitHub Desktop.
Save jdeagle/10c74e18a01c9dfbe5c98b49d44dc309 to your computer and use it in GitHub Desktop.
Watermarking for my photos. Run like `./watermark.sh input_file.jpg`, which produces `input_file_wm.jpg`
#!/bin/bash
if [ "$1" != "" ]; then
dr=$(dirname $1)
scdr=$(dirname $0)
fn=$(basename $1)
filename="${fn%%.*}"
extension="${fn#*.}"
output="${dr}/${filename}_wm.${extension}"
# wm.png is my watermark. It's a white logo with 50% opacity and a transparent background.
wm="${scdr}/wm.png"
echo Generating watermarked version of $1 under $output...
composite -dissolve 100 -gravity southwest $wm $1 $output
echo ...Complete
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment