Outdoor Photography and Videography

Tobi Wulff Photography

Home / Essays / 2016 / July / Challenges Adjusting Time in JPGs and RAWs

Challenges Adjusting Time in JPGs and RAWs

I recently found myself in a situation where I had to adjust the date and time on all my photos from overseas, JPEGs and RAWs. Lesson learned: it is much easier to remember (if you do) to change the setting on the camera when you are switching time zones.

JPEGs

It is fairly easy to change EXIF and IPTC metadata in JPEGs because pretty much all the tools support it. Apart from just writing data directly, most of the tools (and luckily there are many options) I looked at also allow for automatic and intelligent data/time adjustments, so you only have to specify the offset in minutes or hours or whatever unit you require, and it will set the date and time accordingly. In the end this means the choice of the specific program comes down to personal preference. In Linux, there are several options, both for the CLI and as a GUI.

In digikam, the time adjustment can be found in the batch processing editor. To get there, select the photos you want to adjust, then hit B. You can select the individual destinations for the adjust times and I usually go with all the EXIF tags and the digikam timestamp (IPTC wasn't set when the files came out of camera). After the adjustments have been made to the files, it is important to re-read the photos back into digikam. To do this, select the photos again, then go to the menu Item and click "Reread Metadata".

On the CLI, the job is much easier in my opinion (as is often the case). To get a console for the album you want to edit, right-click on the album in the album view (sorry, this technique can't work when you want to edit photos based on tags or other filters; in that case you have to use the GUI method described above) and select "Open in Terminal". Now we can use (if installed) several programs to fix the date/time:

- exiftool: Does not have a date/time adjust option so for JPEGs I would not use it
- exiv2: Can read and write all the tags in JPEGs (and other formats, but not all RAW formats, see below) and has a handy date/time adjust function: "exiv2 ad -a -10 *.JPG" will subtract 10 hours from the EXIF timestamps. It can also be used to rename the files according to the timestamp ("exiv2 mv") but I like to use digikam for that (it can make filenames unique automatically if necessary).
- jhead: Functionality around timestamps and renaming is similar to exiv2 so it comes down to personal taste and specific use cases: "jhead -ta-10:00 *.JPG" will subtract 10 hours.

RAWs

This is were things get a bit trickier and depending on your camera's RAW format some of the programs will not work, e.g. exiv2 supports ORF but not RW2, and the GUI alternatives (digikam or UFRaw) didn't contain any options to write arbitrary metadata. exiv2 can work on some formats as described above (which is nice because it is the shortest and simplest command) but failed to write RW2 (Panasonic). What did work was exiftool. One slight quirk is that while exiftool displays pretty field names when you print all the metadata within a file (no arugments, just "exiftool file.RW2"), it requires the arguments for time adjustment to be the technical, compressed names of all the individual fields that you want to write, so: exiftool -"ModifyDate"-=10 -"DateTimeOriginal"-=10 -"CreateDate"-=10 *.RW2

I hope someone else who is on the search for the right tool to adjust their photos' metadata will find this information useful. I'll keep it as a reference for the future because I'm sure I will forget to set my camera to the right time zone again.

Please use the comment section below or head over to Google+ or Twitter @tobiaswulff to discuss this article or any of my photography and videography work. My Flickr, 500px and Vimeo pages also provide some space to leave comments and keep up to date with my portfolio. Lastly, if you want to get updates on future blog posts, please subscribe to my RSS feed. I plan to publish a new article every Wednesday.