Skip to content

Instantly share code, notes, and snippets.

@gre
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gre/273aec2673d7d40a068a to your computer and use it in GitHub Desktop.
Save gre/273aec2673d7d40a068a to your computer and use it in GitHub Desktop.
Annotate photos with the date. in white. corner bottom right. size of the font relative to the photo resolution.
out=`pwd`/OUT
rm -rf $out
mkdir $out || exit;
for d in raw/*; do
if [ -d $d ]; then
cd $d || exit;
mkdir $out/$d || exit;
for f in *; do
echo "$f => $out/$d/$f";
text=`exiftool -d '%d %b %Y' $f | grep 'Time Original' | head -n 1 | cut -f2 -d':'`;
size=`exiftool $f | egrep "Width|Height" | cut -f2 -d':' | sort -nr | head -1`
size=$((size / 64))
convert $f -font Helvetica -pointsize $size -gravity SouthEast \
-stroke none -fill white -annotate +$size+$((size/2)) "$text" \
$out/$d/$f;
done;
cd ..;
fi;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment