Fixing Dates in Image EXIF Tag Data from Linux

Posted by admin on June 21, 2009 under Tech Tips | 5 Comments to Read

I recently needed to organize a large number of old digital photos that had the wrong date embedded in their EXIF tag data. The camera I used many years ago would often lose track of time and would sometimes be set to the wrong year. Applications I now use to organize photos read this data and made my albums difficult to navigate. I came across a Linux command line utility called jhead that allows you to modify this information to whatever you wish, and its easy to use in scripts as well.  Installing was easy, because it’s currently in most repositories, including Ubuntu’s.

To read existing EXIF tag data, simply run jhead against an image without any options. As you can see from the example below, my date is set to the year 2022.

jhead image.jpg
File name : image.jpg
File size : 159390 bytes
File date : 2004:01:12 07:35:23
Camera make : Samsung
Camera model : Digimax 200
Date/Time : 2022:02:12 04:04:17
Resolution : 800 x 600
Flash used : Yes
Exposure time: 0.045 s (1/22)
Aperture : f/2.8

To clear all EXIF data from the file, use the -de option. Then recreate the EXIF fields with the -mkexif option, and check the data again. Notice the new Date/Time is set to the timestamp on the file.

jhead -de image.jpg
Modified: image.jpg

jhead -mkexif image.jpg
Modified: image.jpg

jhead image.jpg
File name : image.jpg
File size : 147751 bytes
File date : 2004:01:12 07:35:23
Date/Time : 2004:01:12 07:35:23
Resolution : 800 x 600

To change the entire timestamp manually, use the -ts option. Notice, there is no space between the -ts and the option. I could not trust the month and day, so I simply chaged the date to midnight on January 1, 2003.

jhead -ts2003:01:01-00:00:00 image.jpg
Modified: image.jpg

jhead image.jpg
File name : image.jpg
File size : 147751 bytes
File date : 2004:01:12 07:35:23
Date/Time : 2003:01:01 00:00:00
Resolution : 800 x 600

For many more options, check out the man page or visit the jhead site for more info.

Be Sociable, Share!

Comments

  • byancy said,

    jhead can also be used to fix the created/modified date of the image file(s) using the EXIF date, using the following syntax: jhead -ft Wildcards are also accepted for fixing all of the files in a directory: jhead -ft *.jpg. I had a directory full of images that I copied over a network which somehow changed all of the modified dates to the current date!!! I used jhead to fix the dates using the EXIF data in the files themselves. Great tool!

  • where to buy raspberry ketone supplements in canada said,

    My spouse and I stumbled over here different web address
    and thought I may as well check things out.

    I like what I see so now i’m following you. Look forward to looking over your web page again.

  • raspberry ketone australia review said,

    After I initially left a comment I appear to have clicked the -Notify me when new comments
    are added- checkbox and from now on each time a comment is added I receive four emails with the
    exact same comment. Is there a way you are able to remove
    me from that service? Appreciate it!

  • Lavon said,

    ӏt’s going to be end of mine day, except before ending I am reading this great article to increase my knowledge.

  • find-way-net said,

    This approach has one major drawback, enforced upon it by other apps. It relies on accurate file creation dates and EXIF data  – the metadata stored in all image files. Sometimes this data is missing or incorrect.

Add A Comment