man exiftool () - Read/write meta information in images


exiftool - Read/write meta information in images


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


A command-line interface to Image::ExifTool used for reading and writing meta information in image files. CWFILE may be an image file name, a directory name, or CW- for the standard input. Information is read from the specified file and output in readable form to the console (or written to an output text file with the CW-w option).

To write information in an image file, specify new values using either the CW-TAG=[VALUE] syntax or the CW-TagsFromFile option. This causes exiftool to rewrite CWFILE with the specified information, preserving the original file by renaming it to CWFILE_original. (Note: Be sure to verify that the new file is OK before erasing the original.)

Below is a list of meta information formats and file types currently supported by exiftool (r = read support, w = write support):

     Meta Information                        File Type
    ------------------          -----------------------------------
    EXIF           r/w          JPEG  r/w     PNG   r/w     PDF   r
    GPS            r/w          TIFF  r/w     MNG   r/w     PS    r
    IPTC           r/w          GIF   r/w     JNG   r/w     EPS   r
    XMP            r/w          THM   r/w     PPM   r/w     AI    r
    MakerNotes     r/w          CRW   r/w     PGM   r/w     PSD   r
    Photoshop IRB  r/w          CR2   r/w     PBM   r/w     MIFF  r
    JFIF           r            NEF   r/w     JP2   r       PICT  r
    GeoTIFF        r            PEF   r/w     BMP   r       MP3   r
    ICC Profile    r            MRW   r/w     ORF   r       WAV   r
    PrintIM        r            MOS   r/w     RAF   r       MOV   r
    ID3            r            DNG   r/w     SRF   r


Note: Case is not significant for any command-line option (including tag and group names), except for single-character options where the corresponding upper case option is defined. Multiple options can NOT be combined into a single argument, because that would be interpreted as a tag name.

Extract information for specified tag. See Image::ExifTool::TagNames for documentation on available tag names. The tag name may begin with an optional group name followed by a colon. (ie. CW-TAG:GROUP, where CWGROUP is any valid family 0 or 1 group name. Use the CW-group option to list valid group names.) If no tags are specified, all available information is extracted. A special tag name of CWAll may be used to indicate all meta information. This is particularly useful when a group name is specified to extract all information in a group. (CW* is a synonym for CWAll, but must be quoted if used on the command line to prevent shell globbing.)
Exclude specified tag from extracted information. Same as the CW-x option. May also be used following a CW-TagsFromFile option to exclude tags from being extracted from the source file.
Writes a new value for the specified tag, or deletes the tag if CWVALUE is not specified. Use CW+= to add a value to a list without replacing existing values, and CW-= to delete the specifiied value only. Use CW<= to set the value of a tag from the contents of a file with name CWVALUE. (Note: Quotes are required around the argument in this case to prevent shell redirection.) If a group name is not specified for CWTAG, then the information is written to the preferred group, which is the first group in the following list where CWTAG is valid: 1) EXIF, 2) GPS, 3) IPTC, 4) XMP, 5) MakerNotes. The special CWAll tag may be used in this syntax only if a CWVALUE is NOT given. This causes all meta information to be deleted (or all information in a group if CW-GROUP:All= is used). Note that not all groups are deletable. Also, within an image some groups may be contained within others, and these groups are removed if the super group is deleted. Below are lists of these group dependencies:
  JPEG Image:
  - Deleting EXIF or IFD0 also deletes ExifIFD, GlobParamIFD,
    GPS, IFD1, InteropIFD, MakerNotes, PrintIM and SubIFD.
  - Deleting ExifIFD also deletes InteropIFD and MakerNotes.
  - Deleting Photoshop also deletes IPTC.
  TIFF Image:
  - Deleting EXIF only removes ExifIFD which also deletes
    InteropIFD and MakerNotes.
Read command-line arguments from the specified file. The file contains one argument per line. Blank lines and lines beginning with CW# and are ignored. CWARGFILE may exist relative to either the current directory or the exiftool directory unless an absolute pathname is given.
Allow duplicate tag names in the output (otherwise duplicates are suppressed).
Output requested data in binary format. Mainly used for extracting embedded images. Suppresses output of tag names and descriptions.
-c FMT
Set the print format for GPS coordinates. CWFMT uses the same syntax as the CWprintf format string. The specifiers correspond to degrees, minutes and seconds in that order, but minutes and seconds are optional. For example, the following table gives the output for the same coordinate using various formats:
            FMT                  Output
    -------------------    ------------------
    "%d deg %d' %.2f"\"    54 deg 59' 22.80"   (the default)
    "%d deg %.4f min"      54 deg 59.3800 min
    "%.6f degrees"         54.989667 degrees
-d FMT
Set date/time format (consult CWstrftime man page for FMT syntax). The default format is equivalent to %Y:%m:%d CW%H:%M:%S.
Show tag ID number in Decimal.
Print existing tags only don't calculate composite tags.
Escape characters in output values for HTML (implied with the CW-h option).
-ext EXT (or --ext EXT)
Process only files with the specified extension, or use CW--ext to exclude files. There may be multiple CW-ext or CW--ext options. Extensions may begin with a leading '.', and case is not significant. For example:
    exiftool -ext .JPG *            # process only JPG files
    exiftool --ext crw --ext dng *  # process all but CRW and DNG
    exiftool --ext . *              # ignore if no extension
Force printing of tags even if their values are not found.
Organize output by tag group. CW# specifies the group family number, and may be 0 (general location), 1 (specific location) or 2 (category). If not specified, CW-g0 is assumed. Use the CW-group option to list all group names for a specified family.
Same as CW-g but print Group name for each tag.
Show tag ID number in Hexadecimal.
List all tag groups for family #. Family 0 assumed if # not specified.
Use HTML formatting for output (implies CW-E option).
-i DIR
Ignore specified directory name. May be multiple CW-i options.
Use long output format (2-line Canon-style output).
Convert Unicode characters in output to Windows Latin1 (cp1252) instead of the default UTF-8.
List all valid tag names.
List all writable tag names.
Ignore minor errors (allows writing if some minor errors occur, or extraction of embedded images that aren't in standard JPG format).
Read and write values as numbers instead of words. This option disables the print conversion that is applied when extracting values to make them more readable, and the inverse print conversion when writing. For example:
    > exiftool -Orientation -S a.jpg
    Orientation: Rotate 90 CW
    > exiftool -Orientation -S -n a.jpg
    Orientation: 6
and the following two writing commands have the same effect
    > exiftool -Orientation='Rotate 90 CW' a.jpg
    > exiftool -Orientation=6 -n a.jpg
Set output file or directory name when writing information (otherwise the source file is renamed to CWFILE_original and the output file is CWFILE in the original directory).
Overwrite the original file instead of renaming it to CWFILE_original when writing information to an image. Caution: This option should only be used if you already have separate backup copies of your image files.
Print output in the format specified by the given file (and ignore other format options). Tag names in the format file begin with a CW$ symbol and may contain an optional group name. Case is not significant. Lines beginning with CW# are ignored. For example, this 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)
Preserve date/time of original file when writing.
Quiet processing. One CW-q suppresses normal informational messages, and a second CW-q suppresses warnings as well. Error messages can not be suppressed.
Recursively scan subdirectories (only meaningful if CWFILE is a directory name).
Use short output format (add up to 3 CW-s options for even shorter formats).
Print tag names instead of descriptions (very short format, same as two -s options).
Output a tab-delimited list of description/values (useful for database import).
-TagsFromFile SRCFILE or FMT
Set the value of writable tags from information in the specified source file. Tag names on the command line after this option specify information to be extracted (or excluded) from the source file. If no tags are specified, then all tags found in the source file are used. More than one CW-TagsFromFile option may be specified to set tag values from information in different files. By default, this option will commute information between same-named tags in different groups, allowing information to be translated between images with different formats. This behaviour may be modified by specifying a group name for extracted tags (even if CWAll is used as a group name), in which case the information is written to the original group, unless redirected to a different group. A powerful information redirection feature allows a destination tag to be specified for each extracted tag. With this feature, information may be written to a tag with a different name or group. This is done using "CW'-SRCTAG>DSTTAG'" on the command line after CW-TagsFromFile ("CW'-DSTTAG<SRCTAG'" also works). Note that this argument must be quoted to prevent shell redirection, and there is no CW= sign as there is when setting new values. Both source and destination tags may be prefixed by a group name, and CWAll or CW* may be used as a tag or group name. If no destination group is specified, then the information is written to the preferred group. CWSRCFILE may be the same as the target file to move information around within a file. CW@ may be used to represent the target file name (ie. CW-TagsFromFile @), permitting this feature to be used when batch processing multiple files. Specified tags are then copied from each target file in turn as it is rewritten. As a convenience, CW-TagsFromFile @ is assumed for any redirected tags which are specified without a prior CW-TagsFromFile option. For advanced batch use, the source file name may also be specified using a CWFMT string in which CW%d, CW%f and CW%e represent the directory, file name and extension of the target file (similar to the CW-w option). See COPYING EXAMPLES for examples of how to use this option. Be aware of the difference between excluding a tag from being copied (CW--TAG), and deleting a tag (CW-TAG=). Excluding a tag will prevent it from being copied to the destination image, but deleting a tag will remove it if it already exists. Note that the maker note information is set as a block, so it isn't effected like other information by subsequent tag assignments on the command line. For example, to copy all information but the thumbnail image, use CW-ThumbnailImage= after CW-TagsFromFile on the command line. Since the preview image is referenced from the maker notes and may be rather large, it is not copied. Instead, the preview image must be transferred separately if desired.
Extract values of unknown tags (add another CW-u to also extract unknown information from binary data blocks).
Extract values of unknown tags as well as unknown information from binary data blocks (same as two CW-u options).
Print verbose messages (# may be 1-5, higher is more verbose). This option suppresses normal console output unless specific tags are being extracted.
Print version number and exit.
-w EXT or FMT
Write console output to a file with name ending in CWEXT for each source file. The output file name is obtained by replacing the source file extension (including the CW.) with the specified extension. Alternatively, a format statement may be used to give more control over the output file name and directory. In this case, CWFMT is a string specifying the output file name. In this string, CW%d, CW%f and CW%e represent the directory, filename and extension of the source file. Output directories are created automatically if necessary. For example:
    -w %d%f.txt       # same effect as "-w txt"
    -w dir/%f_%e.out  # writes files to "dir" as "FILE_EXT.out"
    -w dir2/%d%f.txt  # writes to "dir2", keeping dir structure
-x TAG
Exclude the specified tag. There may be multiple CW-x options. This has the same effect as CW--TAG on the command line. May also be used following a CW-TagsFromFile option to exclude tags from being extracted from the source file.
Extract information from .gz and .bz2 compressed images.


exiftool -g a.jpg
Print all EXIF information sorted by group (for family 0).
exiftool -common dir
Print common EXIF information for all images in CWdir.
exiftool -S -ImageSize -ExposureTime b.jpg
Print ImageSize and ExposureTime tag names and values.
exiftool -l -canon c.jpg d.jpg
Print standard Canon information from 2 image files.
exiftool -r -w .txt -common pictures
Recursively save common EXIF information for files in CWpictures directory into files with the same names as the images but with a CW.txt extension.
exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg
Save thumbnail image from CWimage.jpg to a file called CWthumbnail.jpg.
exiftool -b -JpgFromRaw -w _JFR.JPG -r .
Recursively extract JPG image from all Canon RAW files in the current directory, adding '_JFR.JPG' for the name of the output JPG files.
exiftool -b -PreviewImage 118_1834.JPG > preview.jpg
Extract preview image from JPG file and write it to CWpreview.jpg. Print formatted date/time for all JPG files in a directory.
exiftool -IFD1:XResolution -IFD1:YResolution
Extract image resolution from IFD1.
exiftool -xmp -b a.jpg > xmp.out
Extract complete XMP data record intact from a.jpg and write it to xmp.out using the special CWXMP tag (see the Extra tags in Image::ExifTool::TagNames).


exiftool -Comment='This is a new comment' dst.jpg
Set comment in file (replaces any existing comment).
exiftool -comment= -o newdir *.jpg
Remove comment from all JPG files in the current directory, writing the modified files to a new directory.
exiftool -keywords=EXIF -keywords=editor dst.jpg
Replace existing keyword list with two new keywords (CWEXIF and CWeditor).
exiftool -Keywords+=word -o newfile.jpg src.jpg
Copy a source image to a new file, and add a keyword (CWword) to the current list of keywords.
exiftool -category-=xxx dir
Delete only the specified category (CWxxx) from all files in directory.
exiftool -all= dst.jpg
Delete all meta information from an image.
exiftool -Photoshop:All= dst.jpg
Delete Photoshop meta information from an image (note that the Photoshop information also includes IPTC).
exiftool '-ThumbnailImage<=thumb.jpg' dst.jpg
Set the thumbnail image from specified file (Note: The quotes are neccessary to prevent shell redirection).
exiftool -xmp:city=Kingston dst.jpg
Write a tag to the XMP group (otherwise in this case the tag would get written to the IPTC group since CWCity exists in both, and IPTC has priority).
exiftool -Canon:ISO=100 dst.jpg
Set CWISO only in the Canon maker notes.
exiftool -LightSource-='Unknown (0)' dst.tiff
Delete CWLightSource tag only if it is unknown with a value of 0.
exiftool -whitebalance-=auto -WhiteBalance=tung dst.jpg
Set CWWhiteBalance to CWTungsten only if it was previously CWAuto.


exiftool -TagsFromFile src.crw dst.jpg
Copy the values of all writable tags from CWsrc.crw to CWdst.jpg, writing the information to the preferred groups.
exiftool -TagsFromFile src.crw -all:all dst.jpg
Copy the values of all writable tags from CWsrc.crw to CWdst.jpg, preserving the original tag groups.
exiftool -tagsFromFile a.jpg -XMP:All= -ThumbnailImage= -m b.jpg
Copy all meta information from a.jpg to b.jpg, but do not write the thumbnail image or XMP information.
exiftool -TagsFromFile src.jpg -title -author=Phil dst.jpg
Copy title from one image to another and set a new author name.
exiftool -TagsFromFile a.jpg -ISO -TagsFromFile b.jpg -comment dst.jpg
Copy ISO from one image and Comment from another image to a destination image.
exiftool -tagsfromfile src.jpg -exif:all --subifd:all dst.jpg
Copy only the EXIF information from one image to another, excluding SubIFD tags.
exiftool '-DateTimeOriginal>FileModifyDate' dir
Use the original date from the meta information to set the same file's filesystem modification date for all images in a directory. (Note that CW-TagsFromFile @ is assumed if no other CW-TagsFromFile is specified when redirecting information as in this example.)
exiftool -TagsFromFile src.jpg '-all>xmp:all' dst.jpg
Translate all possible information into XMP format, and update dst.jpg with the new information.
exiftool -tagsFromFile a.jpg -@ iptc2xmp.args -iptc:all= a.jpg
Translate IPTC information to XMP with appropriate tag name conversions, and delete the original IPTC information from an image. This example uses iptc2xmp.args, which is a file included with the ExifTool distribution that contains the required arguments to convert IPTC information to XMP format. Also included with the distribution is xmp2iptc.args, which performs the inverse conversion. Recursively rewrite all CWJPG images in CWdir with information copied from the corresponding CWCRW images in the same directories.


cat a.jpg | exiftool -
Extract information from stdin.
exiftool image.jpg -thumbnailimage -b | exiftool -
Extract information from an embedded thumbnail image.
cat a.jpg | exiftool -iptc:keywords+=fantastic - > b.jpg
Add an IPTC keyword in a pipeline, saving output to a new file.


Copyright 2003-2005, Phil Harvey

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.