Created
November 15, 2016 16:02
-
-
Save codeprimate/3ed02451261b7aa90114c4aef46d693d to your computer and use it in GitHub Desktop.
Annotate Images with Date
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 | |
[ ! -d out ] && mkdir out | |
for img in "$@"; do \ | |
img_width="$(identify -format %w $img)"; \ | |
img_height="$(identify -format %h $img)"; \ | |
label_height=$(bc -l <<< "$img_height/50"); \ | |
img_date=$(stat -l -t "%F" $img | awk '{print $6}'); \ | |
convert -background '#0008' -fill white -gravity center -size ${img_width}x$label_height \ | |
caption:"$img_date" \ | |
-pointsize $label_height \ | |
"$img" +swap -gravity south -composite "out/$img"; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment