ExifTool
Keywords: ExifTool, EXIF, GPS, exif, XMP, IPTC, GeoTIFF, JPG, CRW, CR2, MRW, NEF, PEF, DNG, ORF, Canon, maker notes, THM, RAW, TIFF, Perl, script, extract, thumbnail, parameters, write, edit

# ExifTool by Phil Harvey

### Download Version 4.53 - Feb. 7, 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, CRW, 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

- powerful, fast, and easy to use
- reads EXIF, GPS, IPTC, XMP, MakerNotes, GeoTIFF, ICC Profile and Photoshop IRB records
- writes EXIF, GPS, IPTC, XMP and MakerNotes information
- reads and writes maker notes for many digital cameras
- highly customizable, can extract exactly what you want
- scans entire directory trees
- easy to add support for new camera types by editing ExifTool modules
- option to create text output file for each image file
- extracts thumbnail images
- extracts JPG image from Canon CRW files
- extracts large preview from Canon, Casio, Minolta, Nikon and Pentax images
- ability to organize output into groups

## Writer Limitations

- The write feature is currently under development, and not all tags are currently writable.
- ExifTool will not rewrite a file if it detects a problem with the file format.
- ExifTool has been tested with a wide range of different images, but since it is not possible to test it with every known image type, there is the possibility that it will corrupt some files. Be sure to keep backups of your files.
- Even though ExifTool does some validation of the information written, it is still possible to write illegal values which may cause problems when reading the images with other software. So take care to verify the information you are writing.
- Currently, only UTF-8 (ASCII) encoded XMP information is supported.

## 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 Name | 113_1366.JPG
> Camera Model Name | Canon EOS DIGITAL REBEL
> Shooting Date/Time | 2003:10:31 15:44:19
> Shooting Mode | Program AE
> Tv(Shutter Speed) | 1/60
> Av(Aperture Value) | 5.6
> Metering Mode | Evaluative
> Exposure Compensation | 0
> ISO Speed | 100
> Lens | 18.0 - 55.0mm
> Focal Length | 55.0mm
> Image Size | 2048x3072
> Quality | Normal
> Flash | On
> Flash Type | Built-In Flash
> Flash Exposure Compensation | 0
> Red Eye Reduction | Off
> Shutter Curtain Sync | 1st-curtain sync
> White Balance | Auto
> Focus Mode | AI Focus AF
> Contrast | +1
> Sharpness | +1
> Saturation | +1
> Color Tone | Normal
> File Size | 811KB
> Image Number | 113-1366
> Drive Mode | Continuous shooting
> Owner's Name | Phil 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, MakerNotes, or
        any EXIF IFD name.

        Note: The writing feature is under development.  Currently, EXIF, GPS, IPTC,
        XMP and MakerNotes tags may be written to JPG, TIFF, GIF, CRW, 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)
        -z      - extract information from .gz and .bz2 compressed images

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:

> Family | Group 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

> # add DocumentName tag only if it didn't exist before
> exiftool -DocumentName-= DocumentName='My Document' dst.jpg

> # 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, see the note below.

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.

Note: Information in the MakerNotes may be edited, 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. The exception is the JpgFromRaw image, which may be added or deleted from Canon CRW files. This has been tested and doesn't cause problems for me with the Canon software or Photoshop, however it does confuse Capture One somewhat if this image is missing, so beware.

### 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:

> Syntax | Result
> --- | ---
> -TAG= | Deletes all occurrances of TAG
> -GROUP:TAG= | Deletes TAG only in specified group
> -[GROUP:]TAG=VALUE | Sets value of TAG (only in GROUP if specified)
> -[GROUP:]TAG+=VALUE | Adds value to a tag list (only valid for List type tags)
> -[GROUP:]TAG-=VALUE | Deletes TAG only if it has the specified value
> -[GROUP:]TAG<=FILE | Sets 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.

## Addition Documentation

- ExifTool Revision History
- Image::ExifTool Module Documentation
- Comments on the Subject of Writing Meta Information
- Canon RAW (CRW) File Format Specification

## License

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

## Boldly Go where No Man has Gone Before...

There is still much unknown information in the maker notes for many camera models. (To see this information, run exiftool with the -U option.) If you manage to figure out what any of it means, send me an e-mail and I'll update ExifTool to decode this information. Many thanks to all who have helped so far.

## Acknowledgements

The following sources of information were very useful in helping to figure out the file formats

- wwwis Perl utilites by Alex Knowles
- http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
- http://johnst.org/sw/exiftags/
- http://search.cpan.org/dist/Image-Info/
- http://www.sentex.net/~mwandel/jhead/
- http://cvs.sourceforge.net/viewcvs.py/libexif/libexif/
- http://neuemuenze.heim1.tu-clausthal.de/~sven/crwinfo/
- http://www.cybercom.net/~dcoffin/dcraw/
- http://www.dalibor.cz/minolta/makernote.htm
- http://www.exif.org/makernotes/SanyoMakerNote.html
- http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html
- http://search.cpan.org/~bettelli/Image-MetaData-JPEG-0.11/
- http://www.adobe.com/products/dng/main.html
- http://www.awaresystems.be/imaging/tiff/tifftags.html

And thanks to the following people for their help:

- Malcolm Wotton for his help with the D30 Custom Functions
- David Anson for his help sorting out binary file problems on Windows
- Leon Booyens for his suggestions
- Jeremy Brown for the "35efl" tags
- Dan Heller for his bug reports, detailed suggestions and guidance
- Wayne Smith for his help figuring out the Pentax maker notes
- Michael Rommel for his bug fixes and additions to the Canon maker notes
- Joseph Heled for help figuring out some of the Nikon D70 maker notes
- Joachim Loehr for adding the Casio type 2 maker notes
- Greg Troxel for his suggestions and for adding ExifTool to pkgsrc-wip
- Jay Al-Saadi for his discoveries with the Minolta white balance tag
- Thomas Walter for figuring out some Nikon tags
- Brian Ristuccia for more information about some Nikon tags
- Daniel Pittman for his additions to the Canon WhiteBalance conversion
- Christian Koller for decoding the 20D custom functions
- Juha Eskelinen for figuring out the 20D FileNumber