Last active
April 24, 2019 12:17
-
-
Save 2xlink/80576f9e5d28f54069ae73a2670588e1 to your computer and use it in GitHub Desktop.
Watermarks photos of your personal documents using ImageMagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
if [[ $# -ne 2 ]]; then | |
echo "Usage: $0 IMAGE WATERMARK-TEXT" | |
exit 1 | |
fi | |
FILE=$1 | |
TEXT=$2 | |
TARGET_FILE=${FILE%.*}-watermark.${FILE##*.} | |
convert -size 2000x1000 xc:none -fill "#00000070" \ | |
-gravity NorthWest -pointsize 300 -draw "text 75,80 '$TEXT'" \ | |
-gravity SouthEast -pointsize 300 -draw "text 50,160 '$TEXT'" \ | |
miff:- |\ | |
composite -tile - $FILE $TARGET_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment