ExifTool by Phil Harvey

Download Version 4.36 - Jan. 24, 2005 (Version History)

ExifTool is a highly customizable Perl script that extracts EXIF, GPS, IPTC, XMP, GeoTIFF, ICC Profile and Photoshop IRB meta information from JPG, TIFF, GIF, CRW, THM, CR2, MRW, NEF, PEF, ORF and DNG images. ExifTool also extracts information from the maker notes of many digital cameras by various manufacturers including Canon, Casio, FujiFilm, Minolta/Konica-Minolta, Nikon, Olympus/Epson, Panasonic/Leica, Pentax/Asahi, Sanyo and Sigma/Foveon.

NEW: ExifTool now also has the ability to edit EXIF, GPS, IPTC, XMP and MakerNotes meta information in JPEG, TIFF, GIF, THM, CR2, NEF, PEF and DNG images. When a file is written, the original file is saved with "_original" added to the file name. Be sure to verify that the new file is OK before erasing the original version. Read here for some ramblings on the subject of writing meta information.

Features

Writer Limitations

Running ExifTool

Run 'exiftool' with no arguments to get a description and list of available options.

Currently, ExifTool supports Asahi, Canon, Casio, Epson, Foveon, FujiFilm, Konica-Minolta, Leica, Minolta, Nikon, Olympus, Panasonic, Pentax, Sanyo and Sigma maker notes, but support for new types can easily be added by editing the ExifTool modules.

The ExifTool support modules are very readable. The format for these files is documented in Image/ExifTool/README.

If you make any useful new additions, e-mail me the file so I can add the functionality to the distributed version.

Drop me a note if you find ExifTool useful. My e-mail address is in the README file. Thanks.

Example Output

> exiftool -h -canon pics/113_1366.JPG
File Name113_1366.JPG
Camera Model NameCanon EOS DIGITAL REBEL
Shooting Date/Time2003:10:31 15:44:19
Shooting ModeProgram AE
Tv(Shutter Speed)1/60
Av(Aperture Value)5.6
Metering ModeEvaluative
Exposure Compensation0
ISO Speed100
Lens18.0 - 55.0mm
Focal Length55.0mm
Image Size2048x3072
QualityNormal
FlashOn
Flash TypeBuilt-In Flash
Flash Exposure Compensation0
Red Eye ReductionOff
Shutter Curtain Sync1st-curtain sync
White BalanceAuto
Focus ModeAI Focus AF
Contrast+1
Sharpness+1
Saturation+1
Color ToneNormal
File Size811KB
Image Number113-1366
Drive ModeContinuous shooting
Owner's NamePhil Harvey
Camera Body No.0560012345

Command Line

NAME
    exiftool - print/modify meta information in image files

SYNOPSIS
    exiftool [OPTIONS] [-TAG[[+-<]=[VALUE]] or --TAG...] FILE ...

DESCRIPTION
    Prints or writes information for specified tags from/to listed files. -TAG
    specifies the name of a tag to extract or --TAG to ignore.  FILE may be an
    image file name, a directory name, or - for the standard input. Supported
    file types are JPG, TIFF, GIF, THM, CRW, CR2, MRW, NEF, PEF, ORF and DNG.

    -TAG=VALUE sets the value of a tag, and -TAG= deletes a tag.  -TAG+=VALUE
    adds a value to a list without replacing existing values, and -TAG-=VALUE
    deletes a specific value from a list.  Use "-TAG<=FILENAME" to set the value
    of a tag from the contents of a file (the quotes prevent shell redirection).
    The tag is written to all groups where it is valid if no group is specified.
    A special (and powerful) variation of this syntax, -AllTagsFromFile=SRCFILE,
    allows all writable tags to be set from information in another file.

    Any tag name may be prefixed by a group name to specify the location (ie.
    -GROUP:TAG).  While reading information, any group name in family 0 or 1 may
    be used.  For writing, valid groups are EXIF, GPS, IPTC, XMP and MakerNotes.

    Note: The writing feature is under development.  Currently, EXIF, GPS, IPTC,
    XMP and MakerNotes tags may be written to JPG, TIFF, GIF, THM, CR2, NEF, PEF
    and DNG files.  Take care to verify that the new file is OK before erasing
    the original (which is renamed to FILE_original).

OPTIONS
    -list   - list all valid tag names
    -listw  - list all writable tag names
    -group# - list all tag groups for family #
    -ver    - print version number and exit
    -a      - allow duplicate tag values (otherwise only last value displayed)
    -b      - output requested data in binary format
    -d FMT  - set date/time format (consult strftime manpage for FMT syntax)
    -D|H    - show tag ID number in Decimal or Hexadecimal
    -e      - print existing tags only -- don't calculate composite tags
    -E      - escape characters in output values for HTML
    -f      - force printing of tags even if their values are not found
    -g[#]   - organize output by tag group (-g0 assumed if # not specified)
    -G[#]   - same as -g but print group name for each tag
    -h      - use HTML formatting for output (implies -E option)
    -i DIR  - ignore specified directory names
    -l      - long output (2-line Canon-style output)
    -m      - ignore minor errors (allows writing if minor errors occur)
    -n      - don't convert values for printing
    -o FILE - output file or dir name for writing (otherwise edits input file)
    -p FILE - print in format specified by file (ignores other format options)
    -P      - preserve date/time of original file when writing
    -r      - recursively scan subdirectories (only useful if "file" is a dir)
    -s      - short format (add up to 3 -s options for even shorter formats)
    -S      - print tag names instead of descriptions (same as two -s options)
    -t      - output tab-delimited list of description/values (database import)
    -u      - extract values of unknown tags (2 to extract from data blocks)
    -U      - also extract unknown from data blocks (same as two -u options)
    -v[#]   - verbose messages (# may be 1-4, higher is more verbose)
    -w EXT  - write console output to file with EXT extension for each image
    -x TAG  - exclude specified tag (may be many -x options)

The -g and -G options organize tags into different families of groups based on the specified family number. Currently, 3 families of groups are defined:

FamilyGroup Names
0 (General Location) Composite, EXIF, ExifTool, File, GPS, GeoTiff, ICC_Profile, IPTC, MakerNotes, Photoshop, PrintIM, XMP
1 (Detailed Location) Canon, CanonCustom, CanonRaw, Casio, Composite, ExifIFD, ExifTool, File, FujiFilm, GPS, GeoTiff, GlobParamIFD, ICC-chrm, ICC-clrt, ICC-header, ICC-meas, ICC-view, ICC_Profile, IFD0, IFD1, IPTC, InteropIFD, MakerUnknown, Minolta, Nikon, NikonPreview, Olympus, Panasonic, Pentax, Photoshop, PrintIM, Sanyo, Sigma, Sony, SubIFD, XMP, XMP-aux, XMP-crs, XMP-dc, XMP-exif, XMP-pdf, XMP-photoshop, XMP-tiff, XMP-xmp, XMP-xmpBJ, XMP-xmpMM, XMP-xmpRights
2 (Category) Author, Camera, ExifTool, Image, Location, Other, Printing, Time, Unknown

Examples

Reading:

# print common EXIF information from "dir/a.jpg":
exiftool -common dir/a.jpg

# print all EXIF information from "dir/a.jpg" sorted by group (for group family 0):
exiftool -g dir/a.jpg

# print ImageSize and ExposureTime tags without colon separators:
exiftool -s -ImageSize -ExposureTime b.jpg

# print standard Canon information from 2 image files:
exiftool -l -canon c.jpg d.jpg

# save common EXIF information for each file in the "pictures" directory and all subdirectories into files with the same names as the images but with a ".txt" extension:
exiftool -r -w .txt -common pictures

# extract thumbnail image from "image.jpg" and save it to the file "thumbnail.jpg":
exiftool -b -ThumbnailImage image.jpg >thumbnail.jpg

# recursively extract JPG from all Canon RAW files in the current directory, adding "_JFR.JPG" for the name of the output JPG files:
exiftool -b -JpgFromRaw -w _JFR.JPG -r .

# extract preview image from JPG write it to "preview.jpg" (this is the 1536x1024 review image for the Canon 300D):
exiftool -b -PreviewImage 118_1834.JPG > preview.jpg

# print formatted date/time for all JPG files in a directory:
exiftool -d "%r %a, %B %e, %Y" -DateTimeOriginal -S -s *.jpg

# extract image resolution from IFD1:
exiftool -IFD1:XResolution -IFD1:YResolution

Writing:

# set comment in file (replaces any existing comment):
exiftool -comment="This is a new comment" dst.jpg

# remove comment from all JPG files:
exiftool -comment= *.jpg

# replace existing keyword list with two new keywords (EXIF, editor):
exiftool -keywords=EXIF -keywords=editor dst.jpg

# add a keyword (word) to the current list of keywords:
exiftool -keywords+=word dst.jpg

# delete only the specified category (xxx) from all files in directory:
exiftool -category-=xxx dir

# set all writable tags from information in another file:
exiftool -AllTagsFromFile=src.crw dst.jpg

# set thumbnail image from specified file (note: quotes are neccessary):
exiftool "-ThumbnailImage<=thumb.jpg" dst.jpg

# write a tag to the XMP group (otherwise it would get written to the IPTC group since the City tag exists in both, and IPTC has priority):
exiftool -xmp:city=Kingston dst.jpg

# delete LightSource tag only if it is unknown with a value of 0:
exiftool -LightSource-="Unknown (0)" dst.tiff

# set WhiteBalance to Tungsten only if it was previously Auto
exiftool -whitebalance-=auto -WhiteBalance=tung dst.jpg

Piping:

# extract information from stdin:
cat a.jpg | exiftool -

# add an IPTC keyword in a pipeline, saving output to a new file
cat a.jpg | exiftool -iptc:keywords+=fantastic - > b.jpg

Print Format File Syntax (the -p option)

The -p option specifies a file to use for formatting the printed output. Tag names in the file begin with a '$' symbol. Tag names may be prefixed by 'GROUP:' just like on the command line (ie. '$IPTC:Keywords'). Lines beginning with '#' are ignored. For example, the following print format file
# this is a comment line
File $FileName was created on $DateTimeOriginal
(f/$Aperture, $ShutterSpeed sec, ISO $EXIF:ISO)
produces output like this
File test.jpg was created on 2003:10:31 15:44:19
(f/5.6, 1/60 sec, ISO 100)

The Image::ExifTool Perl Library Module

The 'exiftool' script is essentially just a command-line interface to the Image::ExifTool Perl library module which is part of the ExifTool distribution. The Image::ExifTool module can be used in any Perl script to provide easy access to meta information in images. Here is an example a very simple script that uses Image::ExifTool to print out all recognized meta information in a file:
#!/usr/bin/perl -w
use Image::ExifTool 'ImageInfo';
my $file = shift or die "Please specify filename";
my $info = ImageInfo($file);
foreach (keys %$info) {
    print "$_ : $info->{$_}\n";
}
Note that some tag values may be returned as SCALAR references indicating binary data. The simple script above does not handle this case.

See the Image::ExifTool Documentation for more details.

Available Tag Names

Tag names are entered on the command line with a leading '-' in the order you want them displayed. Case is not significant. The tag name may be prefixed by a group name and a colon to specify a location for the tag.

ie) "exiftool -filename -imagesize -exif:fnumber image.jpg"

Current lists of available tag names or writable tag names are obtained using the -list or -listw options.

Notes:

  1. Tag names sometimes differ from their descriptions. Use the '-S' command-line option to see the actual tag names instead of the descriptions when extracting information.
  2. Values are only displayed for tags that exist in the specified file when extracting information (unless the -f option is used).

Writing Meta Information

ExifTool writes five different types of meta information:

1) EXIF   2) GPS   3) IPTC   4) XMP   5) MakerNotes
Many tag names are valid for more than one of these groups. If a specific group is not given then new information is added only to the highest priority group for which the tag name is valid (but the information is changed in all groups where the tag already existed). The priority of the groups is given by the list above. Information is added preferentially to the EXIF or GPS group (there are no common tag names between these two groups). If the tag isn't valid in either of these two groups, the information is added to the IPTC group, or finally the XMP group. The MakerNotes group is special: Information in this group may be changed but not added or deleted. The reason for this is to avoid confusing manufacturer-specific software which may be very inflexible about the information it expects in the maker notes.

Alternatively, information may be written to a specific group only, bypassing these priorities, by providing a group name for the tag. The section below gives the syntax rules for exiftool command-line arguments to do this.

Argument Syntax for Writing Information

Tag values are writen rather than being extracted if the tag name ends with a '=' symbol. The '=' may be prefixed by '+', '-' or '<' to add a value, remove a value or set a value from file. The following table outlines the different write syntaxes:

SyntaxResult
-TAG=Deletes all occurrances of TAG
-GROUP:TAG=Deletes TAG only in specified group
-[GROUP:]TAG=VALUESets value of TAG (only in GROUP if specified)
-[GROUP:]TAG+=VALUEAdds value to a tag list (only valid for List type tags)
-[GROUP:]TAG-=VALUEDeletes TAG only if it has the specified value
-[GROUP:]TAG<=FILESets tag value from contents of specified file

Note that quotes are required around VALUE if it contains spaces, and around the whole argument if the '<=' syntax is used (to prevent shell redirection).

AllTagsFromFile

A special option of ExifTool allows copying all tags from one file to another. The command-line syntax for doing this is "-AllTagsFromFile=SRCFILE". This option is very simple, yet very powerful. This option reads all information from SRCFILE and attempts to write each tag found to the destination file. Depending on the formats of the source and destination files, some of tags read may not be valid in the destination file, in which case they won't be written. No translation between similar tags with different names is done.

License

It's free, and you're free to use it however you want.

Acknowledgements

The following sources of information were very useful in helping to figure out the file formats And thanks to the following people for their help: