2

I have taken 300 photos at an event. Afterwards I noticed that the date was set incorrectly in the camera - one day off. There are lots of EXIF data in the files, not just creation dates.

How can I change only the dates contained within all relevant EXIF fields to correct the date (minus one day exactly)?

No other data should be changed by this modification!

Perhaps for each file I could dump the data (exiftool or exiv2?), then modify the dump (with awk?), then replace EXIF data from the modified dump? But how?

EDIT:

There is a lot of data per file:

# exiftool IMG_9040.JPG | wc 
    289    2218   13996

Lots of it are dates:

# exiftool IMG_9040.JPG | grep 2021 | grep -v File
Modify Date                     : 2021:11:02 17:06:58
Date/Time Original              : 2021:11:02 17:06:58
Create Date                     : 2021:11:02 17:06:58
Create Date                     : 2021:11:02 17:06:58.24+01:00
Date/Time Original              : 2021:11:02 17:06:58.24+01:00
Modify Date                     : 2021:11:02 17:06:58.24+01:00

I wish to change all of these.

3
  • Can you provide an example of one photo's EXIF data? Nov 3, 2021 at 18:49
  • 1
    @jubilatious1 That's about 300 lines. Added the relevant parts!
    – Ned64
    Nov 3, 2021 at 23:38
  • 1
    Answer below, but also check out: exiftool.org/forum Nov 4, 2021 at 18:03

2 Answers 2

4

Exiftool has an -alldates parameter:

exiftool -alldates-=24 -filemodifydate-=24 -filecreatedate-=24   *.jpg

The above code works to subtract 24 hours according to this Forum comment (by Phil Harvey):

https://exiftool.org/forum/index.php?topic=6330.msg31354#msg31354

You can combine the above code with an -out file specification, like -out ./newJPG.jpg or (in a new directory), with -out ./newdir/newJPG.jpg. The -out specification gets inserted directly after the call to exiftool.

You can also try adding to the -out file specification ( after making backups! ), the option-overwrite_original OR -overwrite_original_in_place, inserted directly after the call to exiftool. See exiftool --help for details.

Note, an earlier revision of this post suggested using the -globalTimeShift parameter, as in:

exiftool -globalTimeShift -24 -time:all  *.jpg

However (according to Phil Harvey), "The -globalTimeShift option is needed only when you want to copy a shifted date/time value to another tag.", such as a -geo tag. See:

https://exiftool.org/forum/index.php?topic=9224.msg47655#msg47655
https://exiftool.org/forum/index.php?topic=6330.msg31354#msg31354

https://exiftool.org/exiftool_pod.html
https://exiftool.org/

1
  • If anyone came here looking for how to do this with video files where -alldates is insufficient, you can configure a similar shortcut and use it like this: exiftool -VidTime-=24 *.mp4
    – victorlin
    May 5 at 17:07
2

You can type :

exiftool -EXIF:CreateDate+=24 img.jpg

To add 24 hour.

2
  • Thanks! I have added the data from an example file above. Do I need to do that for each of these dates separately? (How?)
    – Ned64
    Nov 3, 2021 at 23:39
  • You can add extra parameters to adjust each one. The documentation for exiftool is pretty good Nov 3, 2021 at 23:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .