Skip to content

Instantly share code, notes, and snippets.

@dhil
Created October 9, 2020 14:19
Show Gist options
  • Save dhil/20148ee55c888d0f323c86ceb507d972 to your computer and use it in GitHub Desktop.
Save dhil/20148ee55c888d0f323c86ceb507d972 to your computer and use it in GitHub Desktop.
A script to watermark pictures
#!/usr/bin/env bash
# Acknowledgement: this idea is adapted from Raphaël Rigo (https://twitter.com/_trou_/status/1313951783182651393?s=20).
if [[ -z "${1+x}" || -z "${2+x}" || -z "${3+x}" ]]; then
echo "usage: $(basename $0) <source-file> <text> <output-file>"
exit 0
fi
convert -density 150 -fill "rgba(255,0,0,0.25)" -gravity Center -pointsize 80 -draw "rotate -45 text 0,0 \"$2\"" "$1" "$3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment