Created
June 24, 2019 06:24
-
-
Save aozimkov/8b3fc7b3cf7f4a6bc89ec2679637702d to your computer and use it in GitHub Desktop.
Add text watermark with imagemagic (example)
This file contains hidden or 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 | |
mkdir img-with-watermark | |
WATERMARK='Some text here' | |
for FILE in *.jpg; do | |
W=`identify -verbose "$FILE" | grep -oe "Geometry:.*" | sed -e 's/.*: //' | sed -e 's/x.*//'` | |
H=`identify -verbose "$FILE" | grep -oe "Geometry:.*" | sed -e 's/.*x//' | sed -e 's/+.*//'` | |
convert -background '#0000' -fill '#0004' -gravity center -size "$W"x"$(($H / 6))" caption:"$WATERMARK" ./"$FILE" +swap -gravity center -composite ./img-with-watermark/"$FILE" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment