Related Entries

Nikon Coolpix 2500: White Balance Gone Outdoors
Wink
Button maker
The Century Project
Earth view

« Leo script to generate environment setters
» It is not funny anymore!

Annotating photos with date

Quick command line script to annotate dates on to photos

With Imagemagick, you can easily annotate your digital photographs with the date. This assumes that the date information is captured within the photograph - most digital cameras do this (and most common mistake I do is to remember to set the date when I insert the battery back after charging!). Here is a small shell script to do this. Save it as an executable file and then run it with all files you want to convert. The annotated files have a prefix of ts_.

#!/bin/sh
while [ "$1" ]
do
  echo "$1 -> ts_$1"
  #get timestamp
  ts=`identify -verbose $1 | \
       grep 'Exif:DateTime:'| \
       awk '{printf("%s %s", $2,$3);}'`
  #stamp it on bottom right corner
  convert $1 -gravity southeast \
        -annotate 0 "$ts" ts_$1
  shift
done

You can update the script to be more artistic by referring to examples of annotation styles.