Tuesday, February 19, 2013

Fixing the wrong date and time in your photographs

Ever set the calendar date and time on your camera incorrectly? And then all your albums are wrong, or they upload to a service like Flickr or Picasa incorrectly?

Recently I came across some photos that were wrong by the year: I'd gotten a new camera for Christmas, it arrived in the New Year, and and set the year wrongly ie to the previous year. Everything else was right such as the date of the month and time.

This tip uses EXIFTool to adjust the EXIF data which is the data inside the photo that says when it was taken.


    exiftool -DateTimeOriginal+="1:0:0 0:00:0" IMG_0020.JPG
    exiftool -DateTimeOriginal+="1:0:0 0:00:0" /path/to/directory/ 

The command above adjust forward by one year for either a single file or a whole directory

the one below back by a year


    exiftool -DateTimeOriginal-="1:0:0 0:00:0" IMG_0020.JPG
    exiftool -DateTimeOriginal-="1:0:0 0:00:0" /path/to/directory/ 

You can see the fields which allows you to adjust by a variety of options:



    years:months:days hours:minutes:seconds

As always its best to try this on a copied file first.


Don't forget to set the file system date / time to the EXIF by running

    exiftool '-DateTimeOriginal>FileModifyDate' IMG_0020.JPG
    exiftool '-DateTimeOriginal>FileModifyDate' /path/to/directory/
This will make the photos display correctly when browsing them on your computer.

No comments: