Sunday, 31 October 2010

Change year field in EXIF data of multiple pictures

Here's a common problem:
I remove the batteries of my camera, charge them and put them back in. Meanwhile, the camera's gone all Alzheimer's on me and forgotten what date it is. Stupidly, I've forgotten the year and entered it incorrectly. I go on my trip, take my pictures and return with a bucketful of pictures - all tagged with the wrong year. What to do?
It's simple, I first get jhead:

$ sudo apt-get install jhead

Next, I write a simple script (let's call it change_exif.sh) with the following contents:

#~/bin/bash
for i in *.jpg
do
jhead -ds2010 $i
jhead -ft $i
done

Make the file executable:

$ chmod 777 change_exif.sh

And of course, run it:

$ sh change_exif.sh

Sit back and relax while your files get properly tagged. Don't forget to make a backup before you do this in case anything goes wrong (not that anything will go wrong).

1 comment:

  1. Thanks a lot Zubin. Very useful post, the script worked like magic!

    Just for the benefit of mac users - i installed jhead using MacPorts on my mac to make this work.

    ReplyDelete