|
|
Subscribe / Log in / New account

Edit image metadata with ExifTool

By Forrest Cook
September 12, 2007

Phil Harvey's ExifTool utility is a cross-platform Perl-based application that can be used to inspect and modify Exchangeable image file format (Exif) metadata from digital images:

ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in image, audio and video files. ExifTool supports many different types of metadata including EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3, as well as the maker notes of many digital cameras by Canon, Casio, FujiFilm, HP, JVC/Victor, Kodak, Leaf, Minolta/Konica-Minolta, Nikon, Olympus/Epson, Panasonic/Leica, Pentax/Asahi, Ricoh, Sanyo, Sigma/Foveon and Sony.

Exiftool has a long list of features, these include reading and modifying data from a large number of digital cameras, support for a long list of image filetypes, operation on single files and directory trees of files and much more. A huge number of metadata tag names are supported.

Installation of ExifTool on a Ubuntu 7.04 system involved the trivial step of selecting the libimage-exiftool-perl package in the synaptic package management application and selecting "install". The perl-doc package was also added to support the application's online documentation.

ExifTool was run on a test image, the example output shows the large amount of image metadata produced by a modern digital camera (Nikon Coolpix S10). Lots of useful information was found, such as the image resolution, creation date/time and camera exposure settings for the particular image.

Your author experimented a bit with changing some fields in his test image. Changing a writable field was as simple as typing: exiftool -Comment="new comment" DSCN0432.JPG on the command line, but some difficulty was found with modifying multi-word field names, specifically "User Comment". The documentation was consulted and the command exiftool -listw DSCN0432.JPG was run, showing a long list of writable field names. A discrepancy involving inter-word whitespace was found between the displayed field names and those that need to be entered on the command line. The online manual could be a bit more clear on this point.

Still, no luck was had changing the "User Comment" field. The problem was finally resolved by using the -m flag to ignore "minor errors" such as "Bad NikonPreview directory", which showed up when examining images from this particular camera. Running exiftool -m -UserComment="new user comment" DSCN0432.JPG finally produced the desired change to the image metadata.

The project's version history notes the recent release of version 6.96, which adds support for a number of camera manufacturers' subfields and fixes some bugs. The software is available for download from the ExifTool project page, or older versions may be installed from your favorite distribution's package repository. ExifTool has been released under the same licensing terms as the Perl language.

If you need to examine or modify Exif data from digital images, ExifTool is a powerful tool that can get the job done.



to post comments

Edit image metadata with ExifTool

Posted Sep 13, 2007 12:05 UTC (Thu) by ordonnateur (guest, #6652) [Link]

I have recently been hunting down and testing a variety of Exif editing tools, mainly to add geocoding to images. ExifTool is by far the most mature and comprehensive I have found. It is however a complex application to master. I don't think that is so much a flaw of the program as of the Exif not-quite-a-standard-standard. Working with any exif data requires the user to take into account the quirks of what is implemented by particular camera models.

Edit image metadata with ExifTool

Posted Sep 13, 2007 13:31 UTC (Thu) by jordi (guest, #14325) [Link] (1 responses)

Does anyone know if ExifTool supports the following use-case:

I go on a beautiful trip, and start taking pics. But, oh no, after the 3rd day I notice the time on my camera was set incorrectly, and all my date exif data is wrong.

Instead of modifying every picture one by one, what I want to do is to add 48h to the entire set of pictures which have a bad date (before I corrected it on the camera).

I've been looking for this, with no luck. Scripting something should be doable, but I wonder if this tool does it already.

Edit image metadata with ExifTool

Posted Sep 13, 2007 15:28 UTC (Thu) by sitaram (guest, #5959) [Link]

I'm sure it does. Even "jhead", which is nowhere near as powerful as exiftool appears to be, can do it.

From "man jhead":

-ta<+|->[timediff]

Adjust time stored in the Exif header by h:mm backwards or for-wards. Useful when having taken pictures with the wrong time set on the camera, such as after travelling across time zones, or when daylight savings time has changed.

This option changes all Date/time fileds in the exif header, including "DateTimeOriginal" (tag 0x9003) and "DateTimeDigitized" (tag 0x9004).

Edit image metadata with ExifTool

Posted Sep 13, 2007 16:10 UTC (Thu) by ordonnateur (guest, #6652) [Link]

man exiftool

exiftool -DateTimeOriginal-=’0:0:0 1:30:0’ dir
Adjust original date/time of all images in directory "dir" by sub-
tracting one hour and 30 minutes. (This is equivalent to
"-DateTimeOriginal-=1.5". See Image::ExifTool::Shift.pl for
details.)

exiftool -createdate+=3 -modifydate+=3 a.jpg b.jpg
Add 3 hours to the CreateDate and ModifyDate timestamps of two
images.

exiftool -AllDates+=1:30 -if ’$make eq "Canon"’ dir
Shift the values of DateTimeOriginal, CreateDate and ModifyDate
forward by 1 hour and 30 minutes for all Canon images in a direc-
tory. (The AllDates tag is provided as a shortcut for these three
tags, allowing them to be accessed via a single tag.)


Copyright © 2007, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds