Skip to content

Instantly share code, notes, and snippets.

@codeprimate
Created November 15, 2016 16:02
Show Gist options
  • Save codeprimate/3ed02451261b7aa90114c4aef46d693d to your computer and use it in GitHub Desktop.
Save codeprimate/3ed02451261b7aa90114c4aef46d693d to your computer and use it in GitHub Desktop.
Annotate Images with Date
#!/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