Skip to content

Instantly share code, notes, and snippets.

@dcrck
Last active May 5, 2020 22:51
Show Gist options
  • Save dcrck/955cd887ca86264c293086da83be717d to your computer and use it in GitHub Desktop.
Save dcrck/955cd887ca86264c293086da83be717d 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