For specific examples, see the EXAMPLES sections below.
This documentation is displayed if exiftool is run without an input FILE when one is expected.
To write or delete metadata, tag values are assigned using -TAG=[VALUE], and/or the -geotag, -csv= or -json= options. To copy or move metadata, the -tagsFromFile feature is used. By default the original files are preserved with "_original" appended to their names --- be sure to verify that the new files are OK before erasing the originals. Once in write mode, exiftool will ignore any read-specific options.
Note: If FILE is a directory name then only supported file types in the directory are processed (in write mode only writable types are processed). However, files may be specified by name, or the -ext option may be used to force processing of files with any extension. Hidden files in the directory are also processed. Adding the -r option causes subdirectories to be processed recursively, but subdirectories with names beginning with ``.'' are skipped unless -r. is used.
Below is a list of file types and meta information formats currently supported by ExifTool (r = read, w = write, c = create):
File Types ------------+-------------+-------------+-------------+------------ 360 r/w | DPX r | ITC r | ODP r | RIFF r 3FR r | DR4 r/w/c | J2C r | ODS r | RSRC r 3G2 r/w | DSS r | JNG r/w | ODT r | RTF r 3GP r/w | DV r | JP2 r/w | OFR r | RW2 r/w A r | DVB r/w | JPEG r/w | OGG r | RWL r/w AA r | DVR-MS r | JSON r | OGV r | RWZ r AAE r | DYLIB r | K25 r | ONP r | RM r AAX r/w | EIP r | KDC r | OPUS r | SEQ r ACR r | EPS r/w | KEY r | ORF r/w | SKETCH r AFM r | EPUB r | LA r | OTF r | SO r AI r/w | ERF r/w | LFP r | PAC r | SR2 r/w AIFF r | EXE r | LNK r | PAGES r | SRF r APE r | EXIF r/w/c | LRV r/w | PBM r/w | SRW r/w ARQ r/w | EXR r | M2TS r | PCD r | SVG r ARW r/w | EXV r/w/c | M4A/V r/w | PCX r | SWF r ASF r | F4A/V r/w | MACOS r | PDB r | THM r/w AVI r | FFF r/w | MAX r | PDF r/w | TIFF r/w AVIF r/w | FITS r | MEF r/w | PEF r/w | TORRENT r AZW r | FLA r | MIE r/w/c | PFA r | TTC r BMP r | FLAC r | MIFF r | PFB r | TTF r BPG r | FLIF r/w | MKA r | PFM r | TXT r BTF r | FLV r | MKS r | PGF r | VCF r CHM r | FPF r | MKV r | PGM r/w | VRD r/w/c COS r | FPX r | MNG r/w | PLIST r | VSD r CR2 r/w | GIF r/w | MOBI r | PICT r | WAV r CR3 r/w | GPR r/w | MODD r | PMP r | WDP r/w CRM r/w | GZ r | MOI r | PNG r/w | WEBP r CRW r/w | HDP r/w | MOS r/w | PPM r/w | WEBM r CS1 r/w | HDR r | MOV r/w | PPT r | WMA r CSV r | HEIC r/w | MP3 r | PPTX r | WMV r CZI r | HEIF r/w | MP4 r/w | PS r/w | WTV r DCM r | HTML r | MPC r | PSB r/w | WV r DCP r/w | ICC r/w/c | MPG r | PSD r/w | X3F r/w DCR r | ICS r | MPO r/w | PSP r | XCF r DFONT r | IDML r | MQV r/w | QTIF r/w | XLS r DIVX r | IIQ r/w | MRW r/w | R3D r | XLSX r DJVU r | IND r/w | MXF r | RA r | XMP r/w/c DLL r | INSP r/w | NEF r/w | RAF r/w | ZIP r DNG r/w | INSV r | NRW r/w | RAM r | DOC r | INX r | NUMBERS r | RAR r | DOCX r | ISO r | O r | RAW r/w | Meta Information ----------------------+----------------------+--------------------- EXIF r/w/c | CIFF r/w | Ricoh RMETA r GPS r/w/c | AFCP r/w | Picture Info r IPTC r/w/c | Kodak Meta r/w | Adobe APP14 r XMP r/w/c | FotoStation r/w | MPF r MakerNotes r/w/c | PhotoMechanic r/w | Stim r Photoshop IRB r/w/c | JPEG 2000 r | DPX r ICC Profile r/w/c | DICOM r | APE r MIE r/w/c | Flash r | Vorbis r JFIF r/w/c | FlashPix r | SPIFF r Ducky APP12 r/w/c | QuickTime r | DjVu r PDF r/w/c | Matroska r | M2TS r PNG r/w/c | MXF r | PE/COFF r Canon VRD r/w/c | PrintIM r | AVCHD r Nikon Capture r/w/c | FLAC r | ZIP r GeoTIFF r/w/c | ID3 r | (and more)
-TAG or --TAG Extract or exclude specified tag -TAG[+-^]=[VALUE] Write new value for tag -TAG[+-]<=DATFILE Write tag value from contents of file -TAG[+-]<SRCTAG Copy tag value (see -tagsFromFile) -tagsFromFile SRCFILE Copy tag values from file -x TAG (-exclude) Exclude specified tag
Input-output text formatting
-args (-argFormat) Format metadata as exiftool arguments -b (-binary) Output metadata in binary format -c FMT (-coordFormat) Set format for GPS coordinates -charset [[TYPE=]CHARSET] Specify encoding for special characters -csv[[+]=CSVFILE] Export/import tags in CSV format -csvDelim STR Set delimiter for CSV file -d FMT (-dateFormat) Set format for date/time values -D (-decimal) Show tag ID numbers in decimal -E,-ex,-ec (-escape(HTML|XML|C))Escape tag values for HTML, XML or C -f (-forcePrint) Force printing of all specified tags -g[NUM...] (-groupHeadings) Organize output by tag group -G[NUM...] (-groupNames) Print group name for each tag -h (-htmlFormat) Use HTML formatting for output -H (-hex) Show tag ID numbers in hexadecimal -htmlDump[OFFSET] Generate HTML-format binary dump -j[[+]=JSONFILE] (-json) Export/import tags in JSON format -l (-long) Use long 2-line output format -L (-latin) Use Windows Latin1 encoding -lang [LANG] Set current language -listItem INDEX Extract specific item from a list -n (--printConv) No print conversion -p FMTFILE (-printFormat) Print output in specified format -php Export tags as a PHP Array -s[NUM] (-short) Short output format -S (-veryShort) Very short output format -sep STR (-separator) Set separator string for list items -sort Sort output alphabetically -struct Enable output of structured information -t (-tab) Output in tab-delimited list format -T (-table) Output in tabular format -v[NUM] (-verbose) Print verbose messages -w[+|!] EXT (-textOut) Write (or overwrite!) output text files -W[+|!] FMT (-tagOut) Write output text file for each tag -Wext EXT (-tagOutExt) Write only specified file types with -W -X (-xmlFormat) Use RDF/XML output format
Processing control
-a (-duplicates) Allow duplicate tags to be extracted -e (--composite) Do not generate composite tags -ee[NUM] (-extractEmbedded) Extract information from embedded files -ext[+] EXT (-extension) Process files with specified extension -F[OFFSET] (-fixBase) Fix the base for maker notes offsets -fast[NUM] Increase speed when extracting metadata -fileOrder[NUM] [-]TAG Set file processing order -i DIR (-ignore) Ignore specified directory name -if[NUM] EXPR Conditionally process files -m (-ignoreMinorErrors) Ignore minor errors and warnings -o OUTFILE (-out) Set output file or directory name -overwrite_original Overwrite original by renaming tmp file -overwrite_original_in_place Overwrite original by copying tmp file -P (-preserve) Preserve file modification date/time -password PASSWD Password for processing protected files -progress[:[TITLE]] Show file progress count -q (-quiet) Quiet processing -r[.] (-recurse) Recursively process subdirectories -scanForXMP Brute force XMP scan -u (-unknown) Extract unknown tags -U (-unknown2) Extract unknown binary tags too -wm MODE (-writeMode) Set mode for writing/creating tags -z (-zip) Read/write compressed information
Other options
-@ ARGFILE Read command-line arguments from file -k (-pause) Pause before terminating -list[w|f|wf|g[NUM]|d|x] List various exiftool capabilities -ver Print exiftool version number -- End of options
Special features
-geotag TRKFILE Geotag images from specified GPS log -globalTimeShift SHIFT Shift all formatted date/time values -use MODULE Add features from plug-in module
Utilities
-delete_original[!] Delete "_original" backups -restore_original Restore from "_original" backups
Advanced options
-api OPT[[^]=[VAL]] Set ExifTool API option -common_args Define common arguments -config CFGFILE Specify configuration file name -echo[NUM] TEXT Echo text to stdout or stderr -efile[NUM][!] ERRFILE Save names of files with errors -execute[NUM] Execute multiple commands on one line -srcfile FMT Process a different source file -stay_open FLAG Keep reading -@ argfile even after EOF -userParam PARAM[[^]=[VAL]] Set user parameter (API UserParam opt)
A special tag name of "All" may be used to indicate all meta information (ie. -All). This is particularly useful when a group name is specified to extract all information in a group (but beware that unless the -a option is also used, some tags in the group may be suppressed by same-named tags in other groups). The wildcard characters "?" and "*" may be used in a tag name to match any single character and zero or more characters respectively. These may not be used in a group name, with the exception that a group name of "*" (or "All") may be used to extract all instances of a tag (as if -a was used). Note that arguments containing wildcards must be quoted on the command line of most systems to prevent shell globbing.
A "#" may be appended to the tag name to disable the print conversion on a per-tag basis (see the -n option). This may also be used when writing or copying tags.
If no tags are specified, all available information is extracted (as if "-All" had been specified).
Note: Descriptions, not tag names, are shown by default when extracting information. Use the -s option to see the tag names instead.
TAG may contain one or more leading family 0, 1, 2 or 7 group names, prefixed by optional family numbers, and separated colons. If no group name is specified, the tag is created in the preferred group, and updated in any other location where a same-named tag already exists. The preferred group is the first group in the following list where TAG is valid: 1) EXIF, 2) IPTC, 3) XMP.
The wildcards "*" and "?" may be used in tag names to assign the same value to multiple tags. When specified with wildcards, ``unsafe'' tags are not written. A tag name of "All" is equivalent to "*" (except that it doesn't require quoting, while arguments with wildcards do on systems with shell globbing), and is often used when deleting all metadata (ie. "-All=") or an entire group (eg. "-XMP-dc:All=", see note 4 below). Note that not all groups are deletable, and that the JPEG APP14 ``Adobe'' group is not removed by default with "-All=" because it may affect the appearance of the image. However, color space information is removed, so the colors may be affected (but this may be avoided by copying back the tags defined by the ColorSpaceTags shortcut). Use the -listd option for a complete list of deletable groups, and see note 5 below regarding the ``APP'' groups. Also, within an image some groups may be contained within others, and these groups are removed if the containing group is deleted:
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.
Notes:
1) Many tag values may be assigned in a single command. If two assignments affect the same tag, the latter takes precedence (except for list-type tags, for which both values are written).
2) In general, MakerNotes tags are considered ``Permanent'', and may be edited but not created or deleted individually. This avoids many potential problems, including the inevitable compatibility problems with OEM software which may be very inflexible about the information it expects to find in the maker notes.
3) Changes to PDF files by ExifTool are reversible (by deleting the update with "-PDF-update:all=") because the original information is never actually deleted from the file. So ExifTool alone may not be used to securely edit metadata in PDF files.
4) Specifying "-GROUP:all=" deletes the entire group as a block only if a single family 0 or 1 group is specified. Otherwise all deletable tags in the specified group(s) are removed individually, and in this case is it possible to exclude individual tags from a mass delete. For example, "-time:all --Exif:Time:All" removes all deletable Time tags except those in the EXIF. This difference also applies if family 2 is specified when deleting all groups. For example, "-2all:all=" deletes tags individually, while "-all:all=" deletes entire blocks.
5) The ``APP'' group names (``APP0'' through ``APP15'') are used to delete JPEG application segments which are not associated with another deletable group. For example, specifying "-APP14:All=" will NOT delete the APP14 ``Adobe'' segment because this is accomplished with "-Adobe:All".
6) When shifting a value, the shift is applied to the original value of the tag, overriding any other values previously assigned to the tag on the same command line. To shift a date/time value and copy it to another tag in the same operation, use the -globalTimeShift option.
Special feature: Integer values may be specified in hexadecimal with a leading "0x", and simple rational values may be specified as fractions.
By default, this option will update any existing and writable same-named tags in the output FILE, but will create new tags only in their preferred groups. This allows some information to be automatically transferred to the appropriate group when copying between images of different formats. However, if a group name is specified for a tag then the information is written only to this group (unless redirected to another group, see below). If "All" is used as a group name, then the specified tag(s) are written to the same family 1 group they had in the source file (ie. the same specific location, like ExifIFD or XMP-dc). For example, the common operation of copying all writable tags to the same specific locations in the output FILE is achieved by adding "-all:all". A different family may be specified by adding a leading family number to the group name (eg. "-0all:all" preserves the same general location, like EXIF or XMP).
SRCFILE may be the same as FILE to move information around within a single file. In this case, "@" may be used to represent the source file (ie. "-tagsFromFile @"), permitting this feature to be used for batch processing multiple files. Specified tags are then copied from each file in turn as it is rewritten. For advanced batch use, the source file name may also be specified using a FMT string in which %d, %f and %e represent the directory, file name and extension of FILE. (eg. the current FILE would be represented by "%d%f.%e", with the same effect as "@"). See the -w option for FMT string examples.
A powerful redirection feature allows a destination tag to be specified for each copied tag. With this feature, information may be written to a tag with a different name or group. This is done using "'-DSTTAG<SRCTAG'`` or '''-SRCTAG>DSTTAG'" on the command line after -tagsFromFile, and causes the value of SRCTAG to be copied from SRCFILE and written to DSTTAG in FILE. Has no effect unless SRCTAG exists in SRCFILE. Note that this argument must be quoted to prevent shell redirection, and there is no "=" sign as when assigning new values. Source and/or destination tags may be prefixed by a group name and/or suffixed by "#". Wildcards are allowed in both the source and destination tag names. A destination group and/or tag name of "All" or "*" writes to the same family 1 group and/or tag name as the source. If no destination group is specified, the information is written to the preferred group. Whitespace around the ">" or "<" is ignored. As a convenience, "-tagsFromFile @" is assumed for any redirected tags which are specified without a prior -tagsFromFile option. Copied tags may also be added or deleted from a list with arguments of the form "'-SRCTAG+<DSTTAG'`` or '''-SRCTAG-<DSTTAG'" (but see Note 5 below).
An extension of the redirection feature allows strings involving tag names to be used on the right hand side of the "<" symbol with the syntax "'-DSTTAG<STR'", where tag names in STR are prefixed with a "$" symbol. See the -p option and the ``Advanced formatting feature'' section for more details about this syntax. Strings starting with a "=" sign must insert a single space after the "<" to avoid confusion with the "<=" operator which sets the tag value from the contents of a file. A single space at the start of the string is removed if it exists, but all other whitespace in the string is preserved. See note 8 below about using the redirection feature with list-type stags, shortcuts or when using wildcards in tag names.
See ``COPYING EXAMPLES'' for examples using -tagsFromFile.
Notes:
1) Some tags (generally tags which may affect the appearance of the image) are considered ``unsafe'' to write, and are only copied if specified explicitly (ie. no wildcards). See the tag name documentation for more details about ``unsafe'' tags.
2) Be aware of the difference between excluding a tag from being copied (--TAG), and deleting a tag (-TAG=). Excluding a tag prevents it from being copied to the destination image, but deleting will remove a pre-existing tag from the image.
3) The maker note information is copied as a block, so it isn't affected like other information by subsequent tag assignments on the command line, and individual makernote tags may not be excluded from a block copy. Also, since the PreviewImage referenced from the maker notes may be rather large, it is not copied, and must be transferred separately if desired.
4) The order of operations is to copy all specified tags at the point of the -tagsFromFile option in the command line. Any tag assignment to the right of the -tagsFromFile option is made after all tags are copied. For example, new tag values are set in the order One, Two, Three then Four with this command:
exiftool -One=1 -tagsFromFile s.jpg -Two -Four=4 -Three d.jpg
This is significant in the case where an overlap exists between the copied and assigned tags because later operations may override earlier ones.
5) The normal behaviour of copied tags differs from that of assigned tags for list-type tags and conditional replacements because each copy operation on a tag overrides any previous operations. While this avoids duplicate list items when copying groups of tags from a file containing redundant information, it also prevents values of different tags from being copied into the same list when this is the intent. So a -addTagsFromFile option is provided which allows copying of multiple tags into the same list. eg)
exiftool -addtagsfromfile @ '-subject<make' '-subject<model' ...
Similarly, -addTagsFromFile must be used when conditionally replacing a tag to prevent overriding earlier conditions.
Other than these differences, the -tagsFromFile and -addTagsFromFile options are equivalent.
6) The -a option (allow duplicate tags) is always in effect when copying tags from SRCFILE, but the highest priority tag is always copied last so it takes precedence.
7) Structured tags are copied by default when copying tags. See the -struct option for details.
8) With the redirection feature, copying a tag directly (ie. "'-DSTTAG<SRCTAG'``) is not the same as interpolating its value inside a string (ie. '''-DSTTAG<$SRCTAG'") for list-type tags, shortcut tags, tag names containing wildcards, or UserParam variables. When copying directly, the values of each matching source tag are copied individually to the destination tag (as if they were separate assignments). However, when interpolated inside a string, list items and the values of shortcut tags are concatenated (with a separator set by the -sep option), and wildcards are not allowed. Also, UserParam variables are available only when interpolated in a string. Another difference is that a minor warning is generated if a tag doesn't exist when interpolating its value in a string (with "$"), but isn't when copying the tag directly.
Finally, the behaviour is different when a destination tag or group of "All" is used. When copying directly, a destination group and/or tag name of "All" writes to the same family 1 group and/or tag name as the source. But when interpolated in a string, the identity of the source tags are lost and the value is written to all possible groups/tags. For example, the string form must be used in the following command since the intent is to set the value of all existing date/time tags from "CreateDate":
exiftool "-time:all<$createdate" -wm w FILE
Input-output text formatting
Note that trailing spaces are removed from extracted values for most output text formats. The exceptions are "-b", "-csv", "-j" and "-X".
exiftool -args -G1 --filename --directory src.jpg > out.args exiftool -@ out.args -sep ", " dst.jpg
Note: Be careful when copying information with this technique since it is easy to write tags which are normally considered ``unsafe''. For instance, the FileName and Directory tags are excluded in the example above to avoid renaming and moving the destination file. Also note that the second command above will produce warning messages for any tags which are not writable.
As well, the -sep option should be used as in the second command above to maintain separate list items when writing metadata back to image files, and the -struct option may be used when extracting to preserve structured XMP information.
FMT Output ------------------- ------------------ "%d deg %d' %.2f"\" 54 deg 59' 22.80" (default for reading) "%d %d %.8f" 54 59 22.80000000 (default for copying) "%d deg %.4f min" 54 deg 59.3800 min "%.6f degrees" 54.989667 degrees
Notes:
1) To avoid loss of precision, the default coordinate format is different when copying tags using the -tagsFromFile option.
2) If the hemisphere is known, a reference direction (N, S, E or W) is appended to each printed coordinate, but adding a "+" to the format specifier (eg. "%+.6f") prints a signed coordinate instead.
3) This print formatting may be disabled with the -n option to extract coordinates as signed decimal degrees.
CHARSET Alias(es) Description ---------- --------------- ---------------------------------- UTF8 cp65001, UTF-8 UTF-8 characters (default) Latin cp1252, Latin1 Windows Latin1 (West European) Latin2 cp1250 Windows Latin2 (Central European) Cyrillic cp1251, Russian Windows Cyrillic Greek cp1253 Windows Greek Turkish cp1254 Windows Turkish Hebrew cp1255 Windows Hebrew Arabic cp1256 Windows Arabic Baltic cp1257 Windows Baltic Vietnam cp1258 Windows Vietnamese Thai cp874 Windows Thai DOSLatinUS cp437 DOS Latin US DOSLatin1 cp850 DOS Latin1 DOSCyrillic cp866 DOS Cyrillic MacRoman cp10000, Roman Macintosh Roman MacLatin2 cp10029 Macintosh Latin2 (Central Europe) MacCyrillic cp10007 Macintosh Cyrillic MacGreek cp10006 Macintosh Greek MacTurkish cp10081 Macintosh Turkish MacRomanian cp10010 Macintosh Romanian MacIceland cp10079 Macintosh Icelandic MacCroatian cp10082 Macintosh Croatian
TYPE may be "FileName" to specify the encoding of file names on the command line (ie. FILE arguments). In Windows, this triggers use of wide-character i/o routines, thus providing support for Unicode file names. See the ``WINDOWS UNICODE FILE NAMES'' section below for details.
Other values of TYPE listed below are used to specify the internal encoding of various meta information formats.
TYPE Description Default --------- ------------------------------------------- ------- EXIF Internal encoding of EXIF "ASCII" strings (none) ID3 Internal encoding of ID3v1 information Latin IPTC Internal IPTC encoding to assume when Latin IPTC:CodedCharacterSet is not defined Photoshop Internal encoding of Photoshop IRB strings Latin QuickTime Internal encoding of QuickTime strings MacRoman RIFF Internal encoding of RIFF strings 0
See <https://exiftool.org/faq.html#Q10> for more information about coded character sets, and the Image::ExifTool Options for more details about the -charset settings.
The following examples demonstrate basic use of the -csv option:
# generate CSV file with common tags from all images in a directory exiftool -common -csv dir > out.csv # update metadata for all images in a directory from CSV file exiftool -csv=a.csv dir
Empty values are ignored when importing (unless the -f option is used and the API MissingTagValue is set to an empty string, in which case the tag is deleted). Also, FileName and Directory columns are ignored if they exist (ie. ExifTool will not attempt to write these tags with a CSV import). To force a tag to be deleted, use the -f option and set the value to ``-'' in the CSV file (or to the MissingTagValue if this API option was used). Multiple databases may be imported in a single command.
When exporting a CSV file, the -g or -G option adds group names to the tag headings. If the -a option is used to allow duplicate tag names, the duplicate tags are only included in the CSV output if the column headings are unique. Adding the -G4 option ensures a unique column heading for each tag. The -b option may be added to output binary data, encoded in base64 if necessary (indicated by ASCII ``base64:'' as the first 7 bytes of the value). Values may also be encoded in base64 if the -charset option is used and the value contains invalid characters.
When exporting specific tags, the CSV columns are arranged in the same order as the specified tags provided the column headings exactly match the specified tag names, otherwise the columns are sorted in alphabetical order.
When importing from a CSV file, only files specified on the command line are processed. Any extra entries in the CSV file are ignored.
List-type tags are stored as simple strings in a CSV file, but the -sep option may be used to split them back into separate items when importing.
Special feature: -csv+=CSVFILE may be used to add items to existing lists. This affects only list-type tags. Also applies to the -j option.
Note that this option is fundamentally different than all other output format options because it requires information from all input files to be buffered in memory before the output is written. This may result in excessive memory usage when processing a very large number of files with a single command. Also, it makes this option incompatible with the -w option. When processing a large number of files, it is recommended to either use the JSON (-j) or XML (-X) output format, or use -p to generate a fixed-column CSV file instead of using the -csv option.
If JSONFILE is specified, the file is imported and the tag definitions from the file are used to set tag values on a per-file basis. The special ``SourceFile'' entry in each JSON object associates the information with a specific target file. An object with a missing SourceFile or a SourceFile of ``*'' defines default tags for all target files which are combined with any tags specified for the specific SourceFile processed. The imported JSON file must have the same format as the exported JSON files with the exception that the -g option is not compatible with the import file format (use -G instead). Additionally, tag names in the input JSON file may be suffixed with a "#" to disable print conversion.
Unlike CSV import, empty values are not ignored, and will cause an empty value to be written if supported by the specific metadata type. Tags are deleted by using the -f option and setting the tag value to ``-'' (or to the MissingTagValue setting if this API option was used). Importing with -j+=JSONFILE causes new values to be added to existing lists.
By default, ExifTool uses UTF-8 encoding for special characters, but the the -L or -charset option may be used to invoke other encodings. Note that ExifTool uses Unicode::LineBreak if available to help preserve the column alignment of the plain text output for languages with a variable-width character set.
Currently, the language support is not complete, but users are welcome to help improve this by submitting their own translations. To submit a translation, follow these steps (you must have Perl installed for this):
1. Download and unpack the latest Image-ExifTool full distribution.
2. 'cd' into the Image-ExifTool directory.
3. Run this command to make an XML file of the desired tags (eg. EXIF):
./exiftool -listx -exif:all > out.xml
4. Copy this text into a file called 'import.pl' in the exiftool directory:
push @INC, 'lib'; require Image::ExifTool::TagInfoXML; my $file = shift or die "Expected XML file name\n"; $Image::ExifTool::TagInfoXML::makeMissing = shift; Image::ExifTool::TagInfoXML::BuildLangModules($file,8);
5. Run the 'import.pl' script to Import the XML file, generating the 'MISSING' entries for your language (eg. Russian):
perl import.pl out.xml ru
6. Edit the generated language module lib/Image/ExifTool/Lang/ru.pm, and search and replace all 'MISSING' strings in the file with your translations.
7. Email the module ('ru.pm' in this example) to philharvey66 at gmail.com
8. Thank you!!
> exiftool -Orientation -S a.jpg Orientation: Rotate 90 CW > exiftool -Orientation -S -n a.jpg Orientation: 6
The print conversion may also be disabled on a per-tag basis by suffixing the tag name with a "#" character:
> exiftool -Orientation# -Orientation -S a.jpg Orientation: 6 Orientation: Rotate 90 CW
These techniques may also be used to disable the inverse print conversion when writing. For example, the following commands all have the same effect:
> exiftool -Orientation='Rotate 90 CW' a.jpg > exiftool -Orientation=6 -n a.jpg > exiftool -Orientation#=6 a.jpg
Multiple -p options may be used, each contributing a line (or more) of text to the output. Lines beginning with "#[HEAD]" and "#[TAIL]" are output before the first processed file and after the last processed file respectively. Lines beginning with "#[SECT]" and "#[ENDS]" are output before and after each section of files. A section is defined as a group of consecutive files with the same section header (eg. files are grouped by directory if "#[SECT]" contains $directory). Lines beginning with "#[BODY]" and lines not beginning with "#" are output for each processed file. Lines beginning with "#[IF]" are not output, but all BODY lines are skipped if any tag on an IF line doesn't exist. Other lines beginning with "#" are ignored. For example, this format file:
# this is a comment line #[HEAD]-- Generated by ExifTool $exifToolVersion -- File: $FileName - $DateTimeOriginal (f/$Aperture, ${ShutterSpeed}s, ISO $EXIF:ISO) #[TAIL]-- end --
with this command:
exiftool -p test.fmt a.jpg b.jpg
produces output like this:
-- Generated by ExifTool 12.16 -- File: a.jpg - 2003:10:31 15:44:19 (f/5.6, 1/60s, ISO 100) File: b.jpg - 2006:05:23 11:57:38 (f/8.0, 1/13s, ISO 100) -- end --
The values of List-type tags with multiple items and Shortcut tags representing multiple tags are joined according the the -sep option setting when interpolated in the string.
When -ee (-extractEmbedded) is combined with -p, embedded documents are effectively processed as separate input files.
If a specified tag does not exist, a minor warning is issued and the line with the missing tag is not printed. However, the -f option may be used to set the value of missing tags to '-' (but this may be configured via the MissingTagValue API option), or the -m option may be used to ignore minor warnings and leave the missing values empty. Alternatively, -q -q may be used to simply suppress the warning messages.
The ``Advanced formatting feature'' may be used to modify the values of individual tags with the -p option.
<?php eval('$array=' . `exiftool -php -q image.jpg`); print_r($array); ?>
-s1 or -s - print tag names instead of descriptions -s2 or -s -s - no extra spaces to column-align values -s3 or -s -s -s - print values only (no tag names)
Also effective when combined with -t, -h, -X or -listx options.
Note that an empty separator ("") is allowed, and will join items with no separator when reading, or split the value into individual characters when writing.
For pure binary output (-b used without -j, -php or -X), the first -sep option specifies a list-item separator, and a second -sep option specifies a terminator for the end of the list (or after each value if not a list). In these strings, "\n", "\r" and "\t" may be used to represent a newline, carriage return and tab respectively. By default, binary list items are separated by a newline, and no terminator is added.
-w %d%f.txt # same effect as "-w txt" -w dir/%f_%e.out # write files to "dir" as "FILE_EXT.out" -w dir2/%d%f.txt # write to "dir2", keeping dir structure -w a%c.txt # write to "a.txt" or "a1.txt" or "a2.txt"...
Existing files will not be changed unless an exclamation point is added to the option name (ie. -w! or -textOut!) to overwrite the file, or a plus sign (ie. -w+ or -textOut+) to append to the existing file. Both may be used (ie. -w+! or -textOut+!) to overwrite output files that didn't exist before the command was run, and append the output from multiple source files. For example, to write one output file for all source files in each directory:
exiftool -filename -createdate -T -w+! %d/out.txt -r DIR
Capitalized format codes %D, %F, %E and %C provide slightly different alternatives to the lower case versions. %D does not include the trailing '/', %F is the full filename including extension, %E includes the leading '.', and %C increments the count for each processed file (see below).
Notes:
1) In a Windows BAT file the "%" character is represented by "%%", so an argument like "%d%f.txt" is written as "%%d%%f.txt".
2) If the argument for -w does not contain a valid format code (eg. %f), then it is interpreted as a file extension. It is not possible to specify a simple filename as an argument --- creating a single output file from multiple source files is typically done by shell redirection, ie)
exiftool FILE1 FILE2 ... > out.txt
But if necessary, an empty format code may be used to force the argument to be interpreted as a format string, and the same result may be obtained without the use of shell redirection:
exiftool -w+! %0fout.txt FILE1 FILE2 ...
Advanced features:
A substring of the original file name, directory or extension may be taken by specifying a field width immediately following the '%' character. If the width is negative, the substring is taken from the end. The substring position (characters to ignore at the start or end of the string) may be given by a second optional value after a decimal point. For example:
Input File Name Format Specifier Output File Name ---------------- ---------------- ---------------- Picture-123.jpg %7f.txt Picture.txt Picture-123.jpg %-.4f.out Picture.out Picture-123.jpg %7f.%-3f Picture.123 Picture-123a.jpg Meta%-3.1f.txt Meta123.txt
(Note that special characters may have a width of greater than one.)
For %d and %D, the field width/position specifiers may be applied to the directory levels instead of substring position by using a colon instead of a decimal point in the format specifier. For example:
Source Dir Format Result Notes ------------ ------ ---------- ------------------ pics/2012/02 %2:d pics/2012/ take top 2 levels pics/2012/02 %-:1d pics/2012/ up one directory level pics/2012/02 %:1d 2012/02/ ignore top level pics/2012/02 %1:1d 2012/ take 1 level after top pics/2012/02 %-1:D 02 bottom level folder name /Users/phil %:2d phil/ ignore top 2 levels
(Note that the root directory counts as one level when an absolute path is used as in the last example above.)
For %c, these modifiers have a different effects. If a field width is given, the copy number is padded with zeros to the specified width. A leading '-' adds a dash before the copy number, and a '+' adds an underline. By default, the copy number is omitted from the first file of a given name, but this can be changed by adding a decimal point to the modifier. For example:
-w A%-cZ.txt # AZ.txt, A-1Z.txt, A-2Z.txt ... -w B%5c.txt # B.txt, B00001.txt, B00002.txt ... -w C%.c.txt # C0.txt, C1.txt, C2.txt ... -w D%-.c.txt # D-0.txt, D-1.txt, D-2.txt ... -w E%-.4c.txt # E-0000.txt, E-0001.txt, E-0002.txt ... -w F%-.4nc.txt # F-0001.txt, F-0002.txt, F-0003.txt ... -w G%+c.txt # G.txt, G_1.txt G_2.txt ... -w H%-lc.txt # H.txt, H-b.txt, H-c.txt ... -w I.%.3uc.txt # I.AAA.txt, I.AAB.txt, I.AAC.txt ...
A special feature allows the copy number to be incremented for each processed file by using %C (upper case) instead of %c. This allows a sequential number to be added to output file names, even if the names are different. For %C, a copy number of zero is not omitted as it is with %c. A leading '-' causes the number to be reset at the start of each new directory, and '+' has no effect. The number before the decimal place gives the starting index, the number after the decimal place gives the field width. The following examples show the output filenames when used with the command "exiftool rose.jpg star.jpg jet.jpg ...":
-w %C%f.txt # 0rose.txt, 1star.txt, 2jet.txt -w %f-%10C.txt # rose-10.txt, star-11.txt, jet-12.txt -w %.3C-%f.txt # 000-rose.txt, 001-star.txt, 002-jet.txt -w %57.4C%f.txt # 0057rose.txt, 0058star.txt, 0059jet.txt
All format codes may be modified by 'l' or 'u' to specify lower or upper case respectively (ie. %le for a lower case file extension). When used to modify %c or %C, the numbers are changed to an alphabetical base (see example H above). Also, %c and %C may be modified by 'n' to count using natural numbers starting from 1, instead of 0 (see example F above).
This same FMT syntax is used with the -o and -tagsFromFile options, although %c and %C are only valid for output file names.
1) With -W, a new output file is created for each extracted tag.
2) -W supports three additional format codes: %t, %g and %s represent the tag name, group name, and suggested extension for the output file (based on the format of the data). The %g code may be followed by a single digit to specify the group family number (eg. %g1), otherwise family 0 is assumed. The substring width/position/case specifiers may be used with these format codes in exactly the same way as with %f and %e.
3) The argument for -W is interpreted as a file name if it contains no format codes. (For -w, this would be a file extension.) This change allows a simple file name to be specified, which, when combined with the append feature, provides a method to write metadata from multiple source files to a single output file without the need for shell redirection. For example, the following pairs of commands give the same result:
# overwriting existing text file exiftool test.jpg > out.txt # shell redirection exiftool test.jpg -W+! out.txt # equivalent -W option # append to existing text file exiftool test.jpg >> out.txt # shell redirection exiftool test.jpg -W+ out.txt # equivalent -W option
4) Adding the -v option to -W sends a list of the tags and output file names to the console instead of giving a verbose dump of the entire file. (Unless appending all output to one file for each source file by using -W+ with an output file FMT that does not contain %t, $g or %s.)
5) Individual list items are stored in separate files when -W is combined with -b, but note that for separate files to be created %c or %C must be used in FMT to give the files unique names.
By default, -X outputs flattened tags, so -struct should be added if required to preserve XMP structures. List-type tags with multiple values are formatted as an RDF Bag, but they are combined into a single string when -s or -sep is used. Using -L changes the XML encoding from ``UTF-8'' to ``windows-1252''. Other -charset settings change the encoding only if there is a corresponding standard XML character set. The -b option causes binary data values to be written, encoded in base64 if necessary. The -t option adds tag table information to the output (see -t for details).
Note: This output is NOT the same as XMP because it uses dynamically-generated property names corresponding to the ExifTool tag names, and not the standard XMP properties. To write XMP instead, use the -o option with an XMP extension for the output file.
Processing control
When used with -ee, the -p option is evaluated for each embedded document as if it were a separate input file. This allows, for example, generation of GPS track logs from timed metadata in videos. See <https://exiftool.org/geotag.html#Inverse> for examples.
Setting NUM to 2 causes the H264 video stream in MP4 videos to be parsed until the first Supplemental Enhancement Information (SEI) message is decoded, or 3 to parse the entire H624 stream and decode all SEI information.
exiftool -ext JPG DIR # process only JPG files exiftool --ext cr2 --ext dng DIR # supported files but CR2/DNG exiftool -ext+ txt DIR # supported files plus TXT exiftool -ext "*" DIR # process all files exiftool -ext "*" --ext xml DIR # process all but XML files exiftool -ext "*" --ext . DIR # all but those with no ext
Using this option has two main advantages over specifying "*.EXT" on the command line: 1) It applies to files in subdirectories when combined with the -r option. 2) The -ext option is case-insensitive, which is useful when processing files on case-sensitive filesystems.
Note that all files specified on the command line will be processed regardless of extension unless the -ext option is used.
exiftool -F -exif:resolutionunit=inches image.jpg
Note that a separate -fast setting may be used for evaluation of a -if condition, or when ordering files with the -fileOrder option. See the -if and -fileOrder options for details.
exiftool -fileOrder DateTimeOriginal DIR
Additional -fileOrder options may be added for secondary sort keys. Numbers are sorted numerically, and all other values are sorted alphabetically. Files missing the specified tag are sorted last. The sort order may be reversed by prefixing the tag name with a "-" (eg. "-fileOrder -createdate"). Print conversion of the sorted values is disabled with the -n option, or a "#" appended to the tag name. Other formatting options (eg. -d) have no effect on the sorted values. Note that the -fileOrder option can have a large performance impact since it involves an additional processing pass of each file, but this impact may be reduced by specifying a NUM for the -fast level used during the metadata-extraction phase. For example, -fileOrder4 may be used if TAG is a pseudo System tag. If multiple -fileOrder options are used, the extraction is done at the lowest -fast level. Note that files are sorted across directory boundaries if multiple input directories are specified.
# extract shutterspeed from all Canon images in a directory exiftool -shutterspeed -if '$make eq "Canon"' dir # add one hour to all images created on or after Apr. 2, 2006 exiftool -alldates+=1 -if '$CreateDate ge "2006:04:02"' dir # set EXIF ISO value if possible, unless it is set already exiftool '-exif:iso<iso' -if 'not $exif:iso' dir # find images containing a specific keyword (case insensitive) exiftool -if '$keywords =~ /harvey/i' -filename dir
Adding NUM to the -if option causes a separate processing pass to be executed for evaluating EXPR at a -fast level given by NUM (see the -fast option documentation for details). Without NUM, only one processing pass is done at the level specified by the -fast option. For example, using -if5 is possible if EXPR uses only pseudo System tags, and may significantly speed processing if enough files fail the condition.
The expression has access to the current ExifTool object through $self, and the following special functions are available to allow short-circuiting of the file processing. Both functions have a return value of 1. Case is significant for function names.
End() - end processing after this file EndDir() - end processing of files in this directory (not compatible with the B<-fileOrder> option)
Notes:
1) The -n and -b options also apply to tags used in EXPR.
2) Some binary data blocks are not extracted unless specified explicitly. These tags are not available for use in the -if condition unless they are also specified on the command line. The alternative is to use the $GROUP:all syntax. (eg. Use $exif:all instead of $exif in EXPR to test for the existence of EXIF tags.)
3) Tags in the string are interpolated the same way as with -p before the expression is evaluated. In this interpolation, $/ is converted to a newline and $$ represents a single "$" symbol (so Perl variables, if used, require a double "$").
4) The condition may only test tags from the file being processed. To process one file based on tags from another, two steps are required. For example, to process XMP sidecar files in directory "DIR" based on tags from the associated NEF:
exiftool -if EXPR -p '$directory/$filename' -ext nef DIR > nef.txt exiftool -@ nef.txt -srcfile %d%f.xmp ...
5) The -a option has no effect on the evaluation of the expression, and the values of duplicate tags are accessible only by specifying a group name (such as a family 4 instance number, eg. $Copy1:TAG, $Copy2:TAG, etc).
6) A special ``OK'' UserParam is available to test the success of the previous command when -execute was used, and may be used like any other tag in the condition (ie. ``$OK'').
OUTFILE may be "-" to write to stdout. The output file name may also be specified using a FMT string in which %d, %f and %e represent the directory, file name and extension of FILE. Also, %c may be used to add a copy number. See the -w option for FMT string examples.
The output file is taken to be a directory name if it already exists as a directory or if the name ends with '/'. Output directories are created if necessary. Existing files will not be overwritten. Combining the -overwrite_original option with -o causes the original source file to be erased after the output file is successfully written.
A special feature of this option allows the creation of certain types of files from scratch, or with the metadata from another type of file. The following file types may be created using this technique:
XMP, EXIF, EXV, MIE, ICC/ICM, VRD, DR4
The output file type is determined by the extension of OUTFILE (specified as "-.EXT" when writing to stdout). The output file is then created from a combination of information in FILE (as if the -tagsFromFile option was used), and tag values assigned on the command line. If no FILE is specified, the output file may be created from scratch using only tags assigned on the command line.
Note that this option reverts to the behaviour of the -overwrite_original option when also writing the FileName and/or Directory tags.
If followed by a colon (ie. -progress:), the console window title is set according to the specified TITLE string. If no TITLE is given, a default TITLE string of ``ExifTool %p%%'' is assumed. In the string, %f represents the file name, %p is the progress as a percent, %r is the progress as a ratio, %##b is a progress bar of width ``##'' (20 characters if ``##'' is omitted), and %% is a % character. May be combined with the normal -progress option to also show the progress count in console messages. (Note: For this feature to function correctly on Mac/Linux, stderr must go to the console.)
w - Write existing tags c - Create new tags g - create new Groups as necessary
For example, use "-wm cg" to only create new tags (and avoid editing existing ones).
The level of the group is the SubDirectory level in the metadata structure. For XMP or IPTC this is the full XMP/IPTC block (the family 0 group), but for EXIF this is the individual IFD (the family 1 group).
Other options
For example, the following ARGFILE will set the value of Copyright to ``Copyright YYYY, Phil Harvey'', where ``YYYY'' is the year of CreateDate:
-d %Y -copyright<Copyright $createdate, Phil Harvey
Arguments in ARGFILE behave exactly the same as if they were entered at the location of the -@ option on the command line, with the exception that the -config and -common_args options may not be used in an ARGFILE.
-list # list all tag names -list -EXIF:All # list all EXIF tags -list -xmp:time:all # list all XMP tags relating to time -listw -XMP-dc:All # list all writable XMP-dc tags -listf # list all supported file extensions -listr # list all recognized file extensions -listwf # list all writable file extensions -listg1 # list all groups in family 1 -listd # list all deletable groups -listx -EXIF:All # list database of EXIF tags in XML format -listx -XMP:All -s # list short XML database of XMP tags
When combined with -listx, the -s option shortens the output by omitting the descriptions and values (as in the last example above), and -f adds a 'flags' attribute if applicable. The flags are formatted as a comma-separated list of the following possible values: Avoid, Binary, List, Mandatory, Permanent, Protected, Unknown and Unsafe (see the Tag Name documentation). For XMP List tags, the list type (Alt, Bag or Seq) is added to the flags, and flattened structure tags are indicated by a Flattened flag.
Note that none of the -list options require an input FILE.
Special features
exiftool -geotag trk.log image.jpg exiftool -geotag trk.log "-Geotime<DateTimeOriginal#" image.jpg
When the "Geotime" value is converted to UTC, the local system timezone is assumed unless the date/time value contains a timezone. Writing "Geotime" causes the following tags to be written (provided they can be calculated from the track log, and they are supported by the destination metadata format): GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude, GPSAltitudeRef, GPSDateStamp, GPSTimeStamp, GPSDateTime, GPSTrack, GPSTrackRef, GPSSpeed, GPSSpeedRef, GPSImgDirection, GPSImgDirectionRef, GPSPitch, GPSRoll, AmbientTemperature and CameraElevationAngle. By default, tags are created in EXIF, and updated in XMP only if they already exist. However, "EXIF:Geotime" or "XMP:Geotime" may be specified to write only EXIF or XMP tags respectively. Note that GPSPitch and GPSRoll are non-standard, and require user-defined tags in order to be written.
The "Geosync" tag may be used to specify a time correction which is applied to each "Geotime" value for synchronization with GPS time. For example, the following command compensates for image times which are 1 minute and 20 seconds behind GPS:
exiftool -geosync=+1:20 -geotag a.log DIR
Advanced "Geosync" features allow a linear time drift correction and synchronization from previously geotagged images. See ``geotag.html'' in the full ExifTool distribution for more information.
Multiple -geotag options may be used to concatenate GPS track log data. Also, a single -geotag option may be used to load multiple track log files by using wildcards in the TRKFILE name, but note that in this case TRKFILE must be quoted on most systems (with the notable exception of Windows) to prevent filename expansion. For example:
exiftool -geotag "TRACKDIR/*.log" IMAGEDIR
Currently supported track file formats are GPX, NMEA RMC/GGA/GLL, KML, IGC, Garmin XML and TCX, Magellan PMGNTRK, Honeywell PTNTHPR, Bramor gEO, Winplus Beacon TXT, and GPS/IMU CSV files. See ``GEOTAGGING EXAMPLES'' for examples. Also see ``geotag.html'' in the full ExifTool distribution and the Image::ExifTool Options for more details and for information about geotag configuration options.
# return all date/times, shifted back by 1 hour exiftool -globalTimeShift -1 -time:all a.jpg # set the file name from the shifted CreateDate (-1 day) for # all images in a directory exiftool "-filename<createdate" -globaltimeshift "-0:0:1 0:0:0" \ -d %Y%m%d-%H%M%S.%%e dir
Utilities
exiftool -restore_original -ext jpg DIR
The -delete_original option deletes the "_original" copies of all files specified on the command line. Without a trailing "!" this option prompts for confirmation before continuing. For example, the following command deletes "a.jpg_original" if it exists, after asking ``Are you sure?'':
exiftool -delete_original a.jpg
These options may not be used with other options to read or write tag values in the same command, but may be combined with options such -ext, -if, -r, -q and -v.
Advanced options
Among other things, the advanced options allow complex processing to be performed from a single command without the need for additional scripting. This may be particularly useful for implementations such as Windows drag-and-drop applications. These options may also be used to improve performance in multi-pass processing by reducing the overhead required to load exiftool for each invocation.
For example, to copy metadata from NEF files to the corresponding JPG previews in a directory where other JPG images may exist:
exiftool -ext nef -tagsfromfile @ -srcfile %d%f.jpg dir
If more than one -srcfile option is specified, the files are tested in order and the first existing source file is processed. If none of the source files already exist, then exiftool uses the first -srcfile specified.
A FMT of "@" may be used to represent the original FILE, which may be useful when specifying multiple -srcfile options (eg. to fall back to processing the original FILE if no sidecar exists).
When this option is used, two special UserParam tags (OriginalFileName and OriginalDirectory) are generated to allow access to the original FILE name and directory.
1) Execute "exiftool -stay_open True -@ ARGFILE", where ARGFILE is the name of an existing (possibly empty) argument file or "-" to pipe arguments from the standard input.
2) Write exiftool command-line arguments to ARGFILE, one argument per line (see the -@ option for details).
3) Write "-execute\n" to ARGFILE, where "\n" represents a newline sequence. (Note: You may need to flush your write buffers here if using buffered output.) ExifTool will then execute the command with the arguments received up to this point, send a ``{ready}'' message to stdout when done (unless the -q or -T option is used), and continue trying to read arguments for the next command from ARGFILE. To aid in command/response synchronization, any number appended to the "-execute" option is echoed in the ``{ready}'' message. For example, "-execute613" results in ``{ready613}''. When this number is added, -q no longer suppresses the ``{ready}'' message. (Also, see the -echo3 and -echo4 options for additional ways to pass signals back to your application.)
4) Repeat steps 2 and 3 for each command.
5) Write "-stay_open\nFalse\n" (or "-stay_open\n0\n") to ARGFILE when done. This will cause exiftool to process any remaining command-line arguments then exit normally.
The input ARGFILE may be changed at any time before step 5 above by writing the following lines to the currently open ARGFILE:
-stay_open True -@ NEWARGFILE
This causes ARGFILE to be closed, and NEWARGFILE to be kept open. (Without the -stay_open here, exiftool would have returned to reading arguments from ARGFILE after reaching the end of NEWARGFILE.)
Note: When writing arguments to a disk file there is a delay of up to 0.01 seconds after writing "-execute\n" before exiftool starts processing the command. This delay may be avoided by sending a CONT signal to the exiftool process immediately after writing "-execute\n". (There is no associated delay when writing arguments via a pipe with "-@ -", so the signal is not necessary when using this technique.)
exiftool -p '$test from $filename' -userparam test=Hello FILE
Advanced formatting feature
An advanced formatting feature allows modification of the value of any tag interpolated within a -if or -p option argument, or a -tagsFromFile redirection string. Tag names within these strings are prefixed by a "$" symbol, and an arbitrary Perl expression may be applied to the tag value by placing braces around the tag name and inserting the expression after the name, separated by a semicolon (ie. "${TAG;EXPR}"). The expression acts on the value of the tag through the default input variable ($_), and has access to the full ExifTool API through the current ExifTool object ($self) and the tag key ($tag). It may contain any valid Perl code, including translation ("tr///") and substitution ("s///") operations, but note that braces within the expression must be balanced. The example below prints the camera Make with spaces translated to underlines, and multiple consecutive underlines replaced by a single underline:
exiftool -p '${make;tr/ /_/;s/__+/_/g}' image.jpg
An "@" may be added after the tag name to make the expression act on individual list items for list-type tags, simplifying list processing. Set $_ to undef to remove an item from the list. As an example, the following command returns all subjects not containing the string ``xxx'':
exiftool -p '${subject@;$_=undef if /xxx/}' image.jpg
A default expression of "tr(/\\?*:|"<>\0)()d" is assumed if the expression is empty (ie. "${TAG;}"). This removes the characters / \ ? * : | < > and null from the printed value. (These characters are illegal in Windows file names, so this feature is useful if tag values are used in file names.)
Helper functions
"DateFmt"
Simplifies reformatting of individual date/time values. This function acts on a standard EXIF-formatted date/time value in $_ and formats it according to the specified format string (see the -d option). To avoid trying to reformat an already-formatted date/time value, a "#" must be added to the tag name (as in the example below) if the -d option is also used. For example:
exiftool -p '${createdate#;DateFmt("%Y-%m-%d_%H%M%S")}' a.jpg
"ShiftTime"
Shifts EXIF-formatted date/time string by a specified amount. Start with a leading minus sign to shift backwards in time. See Image::ExifTool::Shift.pl for details about shift syntax. For example, to shift a date/time value back by one year:
exiftool -p '${createdate;ShiftTime("-1:0:0 0")}' a.jpg
"NoDups"
Removes duplicate items from a list with a separator specified by the -sep option. This function is most useful when copying list-type tags. For example, the following command may be used to remove duplicate Keywords:
exiftool -sep '##' '-keywords<${keywords;NoDups}' a.jpg
The -sep option is necessary to split the string back into individual list items when writing to a list-type tag.
An optional flag argument may be set to 1 to cause "NoDups" to set $_ to undef if no duplicates existed, thus preventing the file from being rewritten unnecessarily:
exiftool -sep '##' '-keywords<${keywords;NoDups(1)}' a.jpg
Note that function names are case sensitive.
ExifTool 9.79 and later allow the file name encoding to be specified with "-charset filename=CHARSET", where "CHARSET" is the name of a valid ExifTool character set, preferably "UTF8" (see the -charset option for a complete list). Setting this triggers the use of Windows wide-character i/o routines, thus providing support for most Unicode file names (see note 4). But note that it is not trivial to pass properly encoded file names on the Windows command line (see <https://exiftool.org/faq.html#Q18> for details), so placing them in a UTF-8 encoded -@ argfile and using "-charset filename=utf8" is recommended if possible.
A warning is issued if a specified filename contains special characters and the filename character set was not provided. However, the warning may be disabled by setting "-charset filename=""", and ExifTool may still function correctly if the system code page matches the character set used for the file names.
When a directory name is provided, the file name encoding need not be specified (unless the directory name contains special characters), and ExifTool will automatically use wide-character routines to scan the directory.
The filename character set applies to the FILE arguments as well as filename arguments of -@, -geotag, -o, -p, -srcfile, -tagsFromFile, -csv=, -j= and -TAG<=. However, it does not apply to the -config filename, which always uses the system character set. The "-charset filename=" option must come before the -@ option to be effective, but the order doesn't matter with respect to other options.
Notes:
1) FileName and Directory tag values still use the same encoding as other tag values, and are converted to/from the filename character set when writing/reading if specified.
2) Unicode support is not yet implemented for other Windows-based systems like Cygwin.
3) See ``WRITING READ-ONLY FILES'' below for a note about editing read-only files with Unicode names.
4) Unicode file names with surrogate pairs (code points over U+FFFF) still cause problems.
1) When using the -overwrite_original_in_place option.
2) When writing only pseudo System tags (eg. FileModifyDate).
3) On Windows if the file has Unicode characters in its name, and a) the -overwrite_original option is used, or b) the "_original" backup already exists.
Hidden files in Windows behave as read-only files when attempting to write any real tags to the file --- an error is generated when using the -overwrite_original_in_place, otherwise writing should be successful and the hidden attribute will be removed. But the -if option may be used to avoid processing hidden files (provided Win32API::File is available):
exiftool -if "$fileattributes !~ /Hidden/" ...
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.