EXIFTOOL(1p)
π EXIFTOOL(1p) π
user contributed perl documentation β¨ okay bestie, you've stumbled into the exiftool man page, section 1p, and honestly? It's giving "I read metadata for breakfast". Let's get into it π¦
πΈ NAME πΈ
exiftool β Read and write meta information in files π
β¨ SYNOPSIS β¨
Here's how you summon the thing. Pick your vibe:
π Reading
exiftool [OPTIONS] [-TAG...] [--TAG...] FILE...
βοΈ Writing
exiftool [OPTIONS] -TAG[+-^<]=[VALUE]... FILE...
π Copying
exiftool [OPTIONS] -tagsFromFile SRCFILE [-[DSTTAG<]SRCTAG...] FILE...
π Other
exiftool [ -ver | -list[w|f|r|wf|g[NUM]|d|x|geo] ]
For specific examples, see the EXAMPLES sections below. π
This documentation is displayed ifexiftoolis run without an inputFILEwhen one is expected. (Not it just showing you the manual unprompted, honestly iconic.)
π DESCRIPTION π
It's a command-line interface to Image::ExifTool, used for reading and writing meta information in a whole bunch of file types. FILE is one or more source file names, directory names, or - for the standard input. Metadata gets read from source files and printed in readable form to the console (or written to output text files with -w).
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: IfFILEis 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-extoption may be used to force processing of files with any extension. Hidden files in the directory are also processed. Adding the-roption 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 | DR4 r/w/c | JP2 r/w | ODS r | RW2 r/w
3FR r | DSF r | JPEG r/w | ODT r | RWL r/w
3G2 r/w | DSS r | JSON r | OFR r | RWZ r
3GP r/w | DV r | JXL r/w | OGG r | RM r
7Z r | DVB r/w | K25 r | OGV r | SEQ r
A r | DVR-MS r | KDC r | ONP r | SKETCH r
AA r | DYLIB r | KEY r | OPUS r | SO r
AAC r | EIP r | KVAR r | ORF r/w | SR2 r/w
AAE r | EPS r/w | LA r | ORI r/w | SRF r
AAX r/w | EPUB r | LFP r | OTF r | SRW r/w
ACR r | ERF r/w | LIF r | PAC r | SVG r
AFM r | EXE r | LNK r | PAGES r | SWF r
AI r/w | EXIF r/w/c | LRV r/w | PBM r/w | THM r/w
AIFF r | EXR r | M2TS r | PCAP r | TIFF r/w
APE r | EXV r/w/c | M4A/V r/w | PCAPNG r | TNEF r
ARQ r/w | F4A/V r/w | MACOS r | PCD r | TORRENT r
ARW r/w | FFF r/w | MAX r | PCX r | TTC r
ASF r | FITS r | MEF r/w | PDB r | TTF r
AVI r | FLA r | MIE r/w/c | PDF r/w | TXT r
AVIF r/w | FLAC r | MIFF r | PEF r/w | URL r
AZW r | FLIF r/w | MKA r | PFA r | VCF r
BMP r | FLV r | MKS r | PFB r | VNT r
BPG r | FPF r | MKV r | PFM r | VRD r/w/c
BTF r | FPX r | MNG r/w | PGF r | VSD r
C2PA r | GIF r/w | MOBI r | PGM r/w | VSDX r
CHM r | GLV r/w | MODD r | PLIST r | WAV r
COS r | GPR r/w | MOI r | PICT r | WDP r/w
CR2 r/w | GZ r | MOS r/w | PMP r | WEBP r/w
CR3 r/w | HDP r/w | MOV r/w | PNG r/w | WEBM r
CRM r/w | HDR r | MP3 r | PPM r/w | WMA r
CRW r/w | HEIC r/w | MP4 r/w | PPT r | WMV r
CS1 r/w | HEIF r/w | MPC r | PPTX r | WOFF r
CSV r | HTML r | MPG r | PS r/w | WOFF2 r
CUR r | ICC r/w/c | MPO r/w | PSB r/w | WPG r
CZI r | ICO r | MQV r/w | PSD r/w | WTV r
DCM r | ICS r | MRC r | PSP r | WV r
DCP r/w | IDML r | MRW r/w | QTIF r/w | X3F r/w
DCR r | IIQ r/w | MXF r | R3D r | XCF r
DFONT r | IND r/w | NEF r/w | RA r | XISF r
DIVX r | INSP r/w | NKA r | RAF r/w | XLS r
DJVU r | INSV r | NKSC r/w | RAM r | XLSX r
DLL r | INX r | NRW r/w | RAR r | XMP r/w/c
DNG r/w | ISO r | NUMBERS r | RAW r/w | ZIP r
DOC r | ITC r | NXD r | RIFF r |
DOCX r | J2C r | O r | RSRC r |
DPX r | JNG r/w | ODP r | RTF r |
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)
π OPTIONS π
Okay so, case is not significant for any command-line option (including tag and group names), except for single-character options when the corresponding upper-case option exists. Many single-character options have equivalent long-name versions (shown in brackets), and some options have inverses which are invoked with a leading double-dash. Unrecognized options are interpreted as tag names (for this reason, multiple single-character options may NOT be combined into one argument). And contrary to standard practice, options may appear after source file names on the exiftool command line. Slay. π
π Option Overview π
π·οΈ Tag operations
-TAGor--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[-] STR(-printFormat) β Print output in specified format-phpβ Export tags as a PHP Array-plotβ Output tags as SVG plot file-s[NUM](-short) β Short output format (-sfor tag names)-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)β lets the same tag show up more than once in the output instead of getting deduped β¨-e,(--composite)β says no thank you to generating composite tags, periodt-ee[NUM],(-extractEmbedded)β digs info out of embedded files too π«Ά-ext[+] EXT,(-extension)β only processes files that have the extension you name-F[OFFSET],(-fixBase)β fixes the base for maker notes offsets-fast[NUM]β speeds up metadata extraction, go go go π₯-fileOrder[NUM] [-]TAGβ sets the order your files get processed in-i DIR,(-ignore)β ignores the directory name you specify, not today satan-if[NUM] EXPRβ conditionally processes files based on an expression-m,(-ignoreMinorErrors)β ignores minor errors and warnings (yes queen, peace and quiet)-o OUTFILE,(-out)β sets the output file name, or output directory name-overwrite_originalβ overwrites the original by renaming the tmp file-overwrite_original_in_placeβ overwrites the original by copying the tmp file instead-P,(-preserve)β preserves the file modification date/time π-password PASSWDβ the password used for processing protected files-progress[NUM][:[TITLE]]β shows a file progress count-q,(-quiet)β quiet processing, shhh-r[.],(-recurse)β recursively processes subdirectories-scanForXMPβ a full-on brute force XMP scan-u,(-unknown)β extracts unknown tags-U,(-unknown2)β extracts unknown binary tags too-wm MODE,(-writeMode)β sets the mode used for writing/creating tags-z,(-zip)β reads and writes compressed information
π Other options π
-@ ARGFILEβ reads command-line arguments straight out of a file-k,(-pause)β pauses before terminating-list[w|f|r|wf|g[NUM]|d|x|geo]β lists all kinds of exiftool capabilities-verβ prints the exiftool version number--β end of options, that's a wrap
π¦ Special features π¦
-diff FILE2β compares metadata with another file-geotag TRKFILEβ geotags images from the GPS log you specify-globalTimeShift SHIFTβ shifts every formatted date/time value-use MODULEβ adds features from a plug-in module
π Utilities π
-delete_original[!]β deletes those"_original"backups-restore_originalβ restores from the"_original"backups
π Advanced options π
-api [OPT[[^]=[VAL]]]β sets an ExifTool API option-common_argsβ defines common arguments-config CFGFILEβ specifies the configuration file name-echo[NUM] TEXTβ echoes text to stdout or stderr-efile[NUM][!] TXTFILEβ saves the names of files that errored out-execute[NUM]β executes multiple commands on one line-fileNUM ALTFILEβ loads tags from an alternate file-list_dirβ lists directories themselves, not what's inside them-srcfile FMTβ processes a different source file-stay_open FLAGβ keeps reading the-@argfile even after EOF-userParam PARAM[[^]=[VAL]]β sets a user parameter (that's the API UserParam opt)
π Option Details π
π Tag operations π
-TAG
Extracts the info for the tag you name, like "-CreateDate" for example. You can stack multiple tags in one single command, obsessed. A tag name is literally just the handle that a piece of information answers to. For the full documentation on which tag names exist, go look at Image::ExifTool::TagNames.
A tag name can have leading group names in front of it, separated by colons β like "-EXIF:CreateDate", or "-Doc1:XMP:Creator". And each one of those group names can be prefixed with a digit to pin down the family number, like "-1IPTC:City". (Heads up tho: the API SavePath and SaveFormat options have to be used for the family 5 and 6 groups to be available at all.) Wanna see which group names exist per family? Use the -listg option.
There's a special tag name, "All", that means all meta information (so, -All). This is especially cute when you name a group, because then it extracts everything in that group (but beware bestie: unless you also use the -a option, some tags in that group might get suppressed by same-named tags chilling in other groups). The wildcard characters "?" and "*" work in a tag name too β "?" matches any single character and "*" matches zero or more characters. These cannot be used in a group name, the one exception being that a group name of "*" (or "All") will extract all instances of a tag (like -a was used). Also note that arguments with wildcards have to be quoted on the command line on most systems, otherwise the shell runs off and globs them itself π
You can stick a "#" on the end of a tag name to disable the print conversion for just that tag (peep the -n option). This one works when writing or copying tags too.
If you specify no tags at all, all available information gets extracted (as if "-All" had been specified). No tag left behind.
Note: when extracting information, descriptions, not tag names, are what show up by default. Use the -s option if you wanna see the actual tag names instead.
--TAG
Excludes the tag you name from the extracted information. Same thing as the -x option, just a different fit. Group names and wildcards are allowed exactly like they are for -TAG up above.
Once something has been excluded from the output, a later option cannot bring it back in. Also, this excludes the tag from being used in a "-if" condition, so plan accordingly. You can use it after a -tagsFromFile option to exclude tags from getting copied (and when you're redirecting to another tag, it's the source tag that should be excluded), or to exclude groups from being deleted when you're deleting all information β like "-all= --exif:all", which deletes everything except EXIF information. But ngl, this won't exclude individual tags from a group delete (unless a family 2 group is specified β see note 4 below). Instead, you can recover individual tags with the -tagsFromFile option, like "-all= -tagsfromfile @ -artist".
When reading XMP, exclusions in XMP groups also skip the processing of the corresponding XMP property and any properties it contains, which makes things faster. So for example "--xmp-crs:all" may speed processing up significantly in cases where a whole lot of XMP-crs tags exist. If you wanna use this to bypass a specific XMP property, you have to use the property name instead of the ExifTool tag name β like "--xmp-crs:dabs". And "XMP-all" may be used to mean any XMP namespace, like "--xmp-all:dabs".
-TAG[+-^]=[VALUE]
Writes a new value for the tag you name (eg. "-comment=wow"), or deletes the tag if you give no VALUE (eg. "-comment="). The "+=" and "-=" forms add or remove existing entries from a list, or shift date/time values around (see Image::ExifTool::Shift.pl and notes 6 and 7 below for the deets). "+=" can also increment numerical values (or decrement them, if VALUE is negative), and "-=" can be used to conditionally delete or replace a tag (examples live in "WRITING EXAMPLES"). "^=" writes an empty string instead of deleting the tag when there's no VALUE given, but other than that it's equivalent to "=". (And fr, that caret has to be quoted in the Windows CMD shell.)
TAG may contain one or more leading family 0, 1, 2 or 7 group names, prefixed by optional family numbers, and separated by colons. If you don't specify a group name, the tag gets created in the preferred group, and updated in any other location where a same-named tag already exists. In JPEG and TIFF-format images, the preferred group is the first group in this 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 you specify them with wildcards, "Unsafe" tags are not written. A tag name of "All" is equivalent to "*" (the only difference being that it doesn't need quoting, whereas arguments with wildcards do on systems with shell globbing), and it's 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 might affect the appearance of the image. However, color space information does get removed, so the colors may be affected (you can dodge this by copying back the tags defined by the ColorSpaceTags shortcut). Use the -listd option for the complete list of deletable groups, and check note 5 below about the "APP" groups. Also, within an image some groups can be contained inside other groups, and those contained groups get removed if the containing group is deleted:
JPEG Image:
- Deleting
EXIForIFD0also deletesExifIFD,GlobParamIFD,GPS,IFD1,InteropIFD,MakerNotes,PrintIMandSubIFD. - Deleting
ExifIFDalso deletesInteropIFDandMakerNotes. - Deleting
Photoshopalso deletesIPTC.
TIFF Image:
- Deleting
EXIFonly removesExifIFDwhich also deletesInteropIFDandMakerNotes.
MOV/MP4 Video:
- Deleting
ItemListalso deletesKeystags.
π Notes π
- You can assign a whole lot of tag values in a single command. If two assignments hit the same tag, the latter one wins (except for list-type tags, where both values get written).
- In general, MakerNotes tags are considered
"Permanent"β they may be edited, but not created or deleted individually. This dodges a lot of potential problems, including the inevitable compatibility drama with OEM software that may be super inflexible about what information it expects to find in the maker notes π - Changes made to PDF files by ExifTool are reversible (just delete 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. Not the icon for secret-keeping. - Specifying
"-GROUP:all="deletes the entire group as one block only if a single family 0 or 1 group is specified. Otherwise, all the deletable tags in the group(s) you named get removed individually β and in that case it is possible to exclude individual tags from a mass delete. For example,"-time:all --Exif:Time:All"removes all deletable Time tags except the ones in the EXIF. This same difference applies if family 2 is specified when deleting all groups. For example,"-2all:all="deletes tags individually, while"-all:all="deletes entire blocks. Choose your fighter π - The "APP" group names (
APP0throughAPP15) are how you yeet JPEG application segments that aren't already attached to some other deletable group. So like, if you say-APP14:All=, bestie, it will NOT nuke the APP14"Adobe"segment, because that one gets handled by-Adobe:Allinstead. π Also important: those unnamed APP segments can't be excluded with--APPxx:allwhen you're deleting all information. Noted. π«Ά - When you're shifting a value, the shift gets applied to the original value of the tag β it overrides any other values you'd already assigned to that tag on the same command line. So if you want to shift a date/time value and copy it to another tag in one go, use the
-globalTimeShiftoption. πΈ - The
+=operator is not allowed for shifting a List-type date/time tag (eg.XMP-dc:Date), because+=is already busy adding elements to the list. For that, use-globalTimeShiftinstead. β¨
Special feature, bestie: Integer values may be specified in hexadecimal with a leading "0x", and simple rational values may be specified as fractions. π€
-TAG<=DATFILEor-TAG<=FMTβ sets the value of a tag from the contents of file DATFILE. The file name can also come from a FMT string, where%d,%fand%estand in for the directory, file name and extension of the original FILE (peep the-woption for the full details). Heads up, you need quotes around this argument so the shell doesn't try to redirect, since it's got a"<"symbol in it. If DATFILE/FMT isn't given, it behaves just like-TAG=, meaning the tag is simply deleted. You can also use+<=or-<=to add or delete specific list entries, to conditionally delete/replace tags, or to shift date/time values. π-tagsFromFile SRCFILE or FMTβ copies tag values from SRCFILE over to FILE. Any tag names you put after this option on the command line are the tags to copy, or the tags to exclude from the copy. Wildcards are totally allowed in those tag names. If you don't specify any tags, then every possible tag (see note 1 below) from the source file gets copied to same-named tags in the preferred location of the output file (same as saying-all). And yes, you can use more than one-tagsFromFileoption to copy tags from multiple files. π
By default, this option updates any existing and writable same-named tags in the output FILE, but only creates new tags in their preferred groups. That's the whole point β it lets information auto-transfer to the right group when you're copying between images of different formats. BUT: if a group name is specified for a tag, then the info gets written only to that group (unless you redirect it elsewhere, see below). If "All" is used as a group name, then the specified tag(s) go 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 super common move of copying all writable tags to the same specific locations in the output FILE is done by adding -all:all. A different family can be picked by adding a leading family number to the group name (eg. -0all:all preserves the same general location, like EXIF or XMP). π
SRCFILE can actually be the same as FILE, which is how you move info around within a single file. In that case, "@" can stand in for the source file (ie. -tagsFromFile @), which lets this feature work for batch processing multiple files. Specified tags then get copied from each file in turn as it's rewritten. For advanced batch use, the source file name can also be given as an FMT string where %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.
Now here's the powerful part β the redirection feature, which lets you set a destination tag for each copied tag. With this, information can be written to a tag with a completely different name or group. You do it with '-DSTTAG<SRCTAG' or '-SRCTAG>DSTTAG' on the command line after -tagsFromFile, and it makes the value of SRCTAG get copied from SRCFILE and written to DSTTAG in FILE. It has no effect unless SRCTAG actually exists in SRCFILE. Note that this argument must be quoted to stop shell redirection, and there's no "=" sign like when you're 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 (but the family can be specified by adding a leading number to the group name, eg. "0All" writes to the same family 0 group as the source). If no destination group is specified, the info goes to the preferred group. Whitespace around the ">" or "<" is ignored. As a lil convenience, -tagsFromFile @ is assumed for any redirected tags specified without a prior -tagsFromFile option. Copied tags can also be added to or deleted from a list, or conditionally deleted/replaced, with arguments of the form '-SRCTAG+<DSTTAG' or '-SRCTAG-<DSTTAG' (but see Note 5 below). π«
An extension of the redirection feature lets you use strings involving tag names on the right hand side of the "<" symbol, with the syntax '-DSTTAG<STR', where tag names inside STR are prefixed with a "$" symbol. See the -p option and the "Advanced formatting feature" section for more on this syntax. Strings starting with a "=" sign must insert a single space after the "<" to avoid confusion with the <= operator (the one that sets the tag value from the contents of a file). A single space at the start of the string gets removed if it's there, but all other whitespace in the string is preserved. See note 8 below about using the redirection feature with list-type tags, shortcuts, or when using wildcards in tag names. π§
See "COPYING EXAMPLES" for examples using -tagsFromFile.
Notes:
- Some tags (generally tags that 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. β οΈ - Be aware of the difference between excluding a tag from being copied (
--TAG) and deleting a tag (-TAG=). Excluding a tag keeps it from being copied to the destination image, but deleting will remove a pre-existing tag from the image. Two very different vibes. π - 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 can't be excluded from a block copy. Also, since the
PreviewImagereferenced from the maker notes may be rather large, it is not copied, and must be transferred separately if you want it. π - The order of operations is to copy all specified tags at the point of the
-tagsFromFileoption in the command line. Any tag assignment to the right of the-tagsFromFileoption happens 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 when there's an overlap between the copied and assigned tags, because later operations may override earlier ones. π
- 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 that's the intent. To accumulate values from different operations into the same list, add a
"+"after the initial"-"of the argument, or use the-addTagsFromFileoption. For example:
exiftool -tagsfromfile @ '-subject<make' '-+subject<model' ...
or
exiftool -addtagsfromfile @ '-subject<make' '-subject<model' ...
Similarly, -+DSTTAG or -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. π€
- The
-aoption (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. β - Structured tags are copied by default when copying tags. See the
-structoption for details. π - 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 source tags that are list-type tags, shortcut tags, or tag names containing wildcards. When copying directly, the values of each matching source tag are copied individually to the destination tag (as if they were separate assignments). But when interpolated inside a string, list items and the values of shortcut tags are concatenated (with a separator set by the-sepoption), and wildcards are not allowed. Another difference: 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 is 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
-x TAG(-exclude) β bestie, this one just yeets the tag you name. πͺοΈ Stack as many-xoptions as you want, no limit. It does literally the exact same thing as--TAGon the command line, and the--TAGdocs higher up have the whole story, so go read those for the full tea. π«Ά
π Input-output text formatting π
Quick heads-up before we get into it: for most output text formats, trailing spaces get trimmed off the extracted values. The exceptions β the ones that keep their little space crumbs β are -b, -csv, -j and -X. π
-args(-argFormat) β spits the info out asexiftoolarguments, which is exactly what you want to feed to the-@option when you're writing. β¨ You can pair it with-Gto sneak group names in there too. This is the move for copying tags between images β except it lets you edit the metadata in the middle file (that's"out.args"in the example below, and yes it's iconic for this):
exiftool -args -G1 --filename --directory src.jpg > out.args
exiftool -@ out.args -sep ', ' dst.jpg
β οΈ Be careful with this technique, fr fr. It is so easy to write tags that are normally considered "Unsafe". For instance, theFileNameandDirectorytags are excluded in the example above specifically so you don't rename and move the destination file. Also note: that second command will spit out warning messages for any tags that aren't writable. π
Also also β you should use the -sep option like in the second command above so your separate list items stay separate when the metadata gets written back to the image files, and -struct may be used when extracting if you want to preserve structured XMP information. π
-b,--b(-binary,--binary) β outputs the metadata you asked for in binary format, with no tag names and no descriptions (-bor-binary). This one is mainly for pulling out embedded images or other binary data, but it's also lowkey useful for some text strings, because control characters (newlines, looking at you) don't get swapped out for.the way they do in the default output. By default, list items are separated by a newline when you extract with-b, and no terminator is added after each tag value β but you can change that list separator with a-sepoption, and you can set a terminator by adding a second-sepoption (details live in the-sepoption's docs). You can combine it with-j,-phpor-Xto extract binary data as JSON, PHP or XML format β but heads up, "Unsafe" tags are not extracted as binary unless you specify them explicitly or the APIRequestAlloption is set to 3 or higher. π
With a leading double dash (--b or --binary), tags that contain binary data get suppressed from the output when you're reading. Poof. π
-c FMT(-coordFormat) β sets the print format for GPS coordinates.FMTuses the same syntax as a"printf"format string. The specifiers line up as degrees, minutes and seconds β in that order β but minutes and seconds are optional. Here's the same coordinate in a bunch of different formats so you can see the vibe:
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, bestie, listen up:
- To avoid losing precision, the default coordinate format is different when you're copying tags with the
-tagsFromFileoption. - If the hemisphere is known, a reference direction (N, S, E or W) gets appended to each printed coordinate β but adding a
"+"or"-"to the format specifier (like"%+.6f"or"%-.6f") prints a signed coordinate instead. ("+"adds a leading"+"for positive coordinates, but"-"does not.) - You can turn this print formatting all the way off with the
-noption, which extracts the coordinates as signed decimal degrees.
-charset [[TYPE=]CHARSET]β ifTYPEis"ExifTool"or you just don't specify a type at all, this option sets the ExifTool character encoding for output tag values when reading and input values when writing, and the default is"UTF8". If you don't hand it aCHARSET, it hands you a list of available character sets. The validCHARSETvalues are:
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 can also be "FileName", which specifies the encoding of file names on the command line β aka the FILE arguments. On Windows this triggers the use of wide-character i/o routines, which gives you support for Unicode file names. β¨ See the "WINDOWS UNICODE FILE NAMES" section further down for the details.
The other TYPE values below are for specifying 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
For more info about coded character sets, hit up https://exiftool.org/faq.html#Q10, and the Image::ExifTool Options have the deeper details about the -charset settings. π
-csv[[+]=CSVFILE]β exports info in CSV format, or imports info if you give it aCSVFILE. π When importing, the CSV file has to be in exactly the same format as an exported one. The first row of theCSVFILEmust be the ExifTool tag names (group names optional) for each column, and values must be separated by commas. A special"SourceFile"column says which files each row of information belongs to (and aSourceFileof"*"can be used to define default tags to import for all files, which then get combined with any tags specified for the specificSourceFilebeing processed). To be super clear: the imported CSV file acts as a lookup table for grabbing the tags to import, based on the files/directories and tags you put on the command line. And the-csvDelimoption lets you change the input/output field delimiter if you need something other than a comma. π
Here's the basic use, demonstrated:
# 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
When importing, empty values are ignored β unless you use the -f option 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 (ExifTool will not try to write those tags during a CSV import), but every other column does get imported. 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 that API option was in play). Multiple databases can be imported in a single command. π€
You can import specific tags from the CSV database by adding -TAG options after -csv=CSVFILE, or exclude them with --TAG, and exclusions win. Group names and wildcards in tag names are allowed, but the group name has to match exactly the group in the CSV file (for example, an "XMP-dc:Subject" column in the CSV file won't match "-XMP:Subject" on the command line). Also, tags from the CSV may be redirected and written to different tags in the target file, with support for advanced-formatting expressions using the same syntax as the -tagsFromFile feature. If you specify no tags at all, then all tags except FileName, Directory and any excluded tags get imported (in the same order as the database entries). π
When exporting a CSV file, the -g or -G option adds group names to the tag headings. If you use -a to allow duplicate tag names, those duplicate tags are only included in the CSV output if the column headings are unique β so add -G4 to guarantee a unique column heading for each tag. You can throw -b in there to output binary data too, encoded in base64 if necessary (you'll know because the first 7 bytes of the value will be the ASCII "base64:"). Values may also come out base64-encoded if you use the -charset option and the value contains invalid characters. π₯
When exporting specific tags, the CSV columns are arranged in the same order as the tags you specified β provided the column headings exactly match the specified tag names. Otherwise the columns get sorted alphabetically. Sorting, smh.
When importing from a CSV file, only the files specified on the command line get processed. Any extra entries hanging out in the CSV file are simply ignored. π
List-type tags are stored as simple strings in a CSV file, but the -sep option can split them back into separate items when you import. π«Ά
Special feature alert π
: you can use -csv+=CSVFILE to add items to existing lists in the file β it's giving "append but make it CSV". This only matters for list-type tags, and it also works with the -j option. Slay.
Real talk bestie π«Ά: this option and -plot are fundamentally different from every other output format option, because they need info from all the input files buffered in memory before anything gets written out. The way that means you could end up with excessive memory usage when you're processing a huge number of files in a single command. π
Also, when you use it with -csv, the -w option changes its whole personality β it now specifies a complete file name, with no filename formatting codes and no append mode allowed, and -W may not be used at all. Periodt. When you're processing a large number of files, the recommendation is 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. β¨
-csvDelim STRβ sets the delimiter for separating CSV entries for CSV file input/output via the-csvoption.STRmay contain"\t","\n","\r"and"\\"to represent TAB, LF, CR and'\'respectively. A double quote is not allowed in the delimiter, no cap. Default is','. π-d FMT(-dateFormat) β sets the format for date/time tag values. TheFMTstring may contain formatting codes beginning with a percent character ("%") to represent the various components of a date/time value. ExifTool implements 3 format codes internally (peep below π), but other format codes are system dependent β go consult the"strftime"man page on your system for the deets. The default format is equivalent to"%Y:%m:%d %H:%M:%S". This option has no effect on date-only or time-only tags. RequiresPOSIX::strptimeorTime::Piecefor the inversion conversion when writing. Only one-doption may be used per command. π
Additional format codes implemented internally by ExifTool:
%zrepresents the time zone in"+/-HHMM"format. Adding a colon (ie.%:z) adds a colon separator (eg."-05:00"). If the date/time value doesn't contain a time zone then%zgives the system time zone for the specified date/time value. π%frepresents fractional seconds, and supports an optional width to specify the number of digits after the decimal point (eg.%3fwould give something like".437"). Adding a minus sign drops the decimal point (eg."%-3f"would give"437"). π%srepresents the number of seconds since 00:00 UTC Jan 1, 1970, taking into account the specified time zone (or system time zone if not specified). β
-D(-decimal) β show tag ID number in decimal when extracting information. π’-E,-ex,-ec(-escapeHTML,-escapeXML,-escapeC) β escape characters in output tag values for HTML (-E), XML (-ex) or C (-ec). For HTML, all characters with Unicode code points above U+007F are escaped as well as the following 5 characters:&(&)'(')"(")>(>) and<(<). For XML, only these 5 characters are escaped. The-Eoption is implied with-h,-exis implied with-X,-ecis implied with-json, and none of these options apply to the-csvoutput. For C, all control characters and the backslash are escaped. The inverse conversion is applied when writing tags. β¨-f(-forcePrint) β force printing of tags even if they don't exist. This option applies to tags specified on the command line, or with the-p,-if(unless the APIUndefTagsoption is set),-fileNUMor-tagsFromFileoptions. When-fis used, the value of any missing tag is set to a dash ("-") by default, but this may be configured via the APIMissingTagValueoption.-fis also used to add a'flags'attribute to the-listxoutput, or to allow tags to be deleted when writing with the-csv=CSVFILEfeature. πͺ-g[NUM][:NUM...](-groupHeadings) β organize output by tag group.NUMspecifies a group family number, and may be0(general location),1(specific location),2(category),3(document number),4(instance number),5(metadata path),6(EXIF/TIFF format),7(tag ID) or8(file number).-g0is assumed if a family number is not specified. May be combined with other options to add group names to the output. Multiple families may be specified by separating them with colons. By default the resulting group name is simplified by removing any leading"Main:"and collapsing adjacent identical group names, but this can be avoided by placing a colon before the first family number (eg.-g:3:1). Use the-listgoption to list group names for a specified family. The APISavePathandSaveFormatoptions are automatically enabled if the respective family 5 or 6 group names are requested. See the APIGetGroupdocumentation for more information. ποΈ-G[NUM][:NUM...](-groupNames) β same as-gbut print group name for each tag.-G0is assumed ifNUMis not specified. May be combined with a number of other options to add group names to the output. Note thatNUMmay be added wherever-Gis mentioned in the documentation. See the-goption above for details. π-h(-htmlFormat) β use HTML table formatting for output. Implies the-Eoption. The formatting options-D,-H,-g,-G,-land-smay be used in combination with-hto influence the HTML format. π-H(-hex) β show tag ID number in hexadecimal when extracting information. π₯-htmlDump[OFFSET]β generate a dynamic web page containing a hex dump of the EXIF information. This can be a very powerful tool for low-level analysis of EXIF information, fr fr. The-htmlDumpoption is also invoked if the-vand-hoptions are used together. The verbose level controls the maximum length of the blocks dumped. AnOFFSETmay be given to specify the base for displayed offsets. If not provided, the EXIF/TIFF base offset is used. Use-htmlDump0for absolute offsets. Currently only EXIF/TIFF and JPEG information is dumped, but the-uoption can be used to give a raw hex dump of other file formats. π-j[[+]=JSONFILE](-json) β use JSON (JavaScript Object Notation) formatting for console output, or import JSON file ifJSONFILEis specified. This option may be combined with-gto organize the output into objects by group, or-Gto add group names to each tag. List-type tags with multiple items are output as JSON arrays unless-sepis used. By default XMP structures are flattened into individual tags in the JSON output, but the original structure may be preserved with the-structoption (this also causes all list-type XMP tags to be output as JSON arrays, otherwise single-item lists would be output as simple strings). The-aoption is implied when-jsonis used, but entries with identical JSON names are suppressed in the output. (-G4may be used to ensure that all tags have unique JSON names.) π¦
Adding the -D or -H option changes tag values to JSON objects with "val" and "id" fields. Adding -l adds a "desc" field, and a "num" field if the numerical value is different from the converted "val", and "fmt" and "hex" fields for EXIF metadata if the API SaveFormat and SaveBin options are set respectively. The length of the "hex" output is limited by the API LimitLongValues setting. Setting the SaveBin option also causes the original values of Rational tags to be returned in string form as an extra "rat" field. 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), and -t may be added to include tag table information (see -t for details). The JSON output is UTF-8 regardless of any -L or -charset option setting, but the UTF-8 validation is disabled if a character set other than UTF-8 is specified. π
Note that ExifTool quotes JSON values only if they don't look like numbers (regardless of the original storage format or the relevant metadata specification). This may be a problem when reading the JSON via a strongly typed language. However, the API StructFormat option may be set to "JSONQ" to force quoting of numbers. As well, the -sep option may be used to convert arrays into strings. For example:
exiftool -j -api structformat=jsonq -sep ", " ...
If JSONFILE is specified, the JSON file is imported and the tag definitions from the JSON are used to set tag values on a per-file basis for each file specified on the command line. A 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 options exporting JSON objects instead of simple values are not compatible with the import file format (ie. export with -D, -H, -l, or -T is not compatible, and use -G instead of -g). Additionally, tag names in the input JSON file may be suffixed with a "#" to disable print conversion. π
Specific tags may be imported from the JSON database by adding -TAG options to the command after -j=JSONFILE, or excluded with --TAG, with exclusions taking priority. Group names and wildcards in tag names are allowed, but the group name must match exactly the group in the JSON file (eg. a "XMP-dc:Subject" entry in the JSON file won't match "-XMP:Subject" on the command line. Also, tags from JSON may be redirected and written to different tags in the target file with support for advanced-formatting expressions using the same syntax as the -tagsFromFile feature. If no tags are specified, then all tags except FileName, Directory and excluded tags are imported (in the same order as the database entries). π§
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 in the target file. π
-lor-longβ okay so this one gives you the long 2-line Canon-style output π. It adds a description and the unconverted value (only when it's actually different from the converted value, no pointless dupes here π ) to the XML, JSON or PHP output when-X,-jor-phpis in play. You can also stack it with-listf,-listror-listwfto add descriptions of the file types. Versatile queen π-Lor-latinβ this makes the output tag values use Windows Latin1 encoding (cp1252) instead of the default UTF-8. And when you're writing,-Lsays the input text values are Latin1 instead of UTF-8. It's literally the same thing as-charset latin. Same energy, different name β¨-lang [LANG]β sets the current language for tag descriptions and converted values.LANGis likede,fr,ja, etc. Run-langwith no other arguments and it hands you a list of the available languages, cute right? The default language isenif you never specify-lang. Heads up bestie: tag/group names are always English no matter what-langsays, and translating the warning/error messages hasn't been implemented yet π. You can also combine it with-listxto output descriptions in one language only.
By default ExifTool uses UTF-8 encoding for special characters, but -L or -charset can invoke other encodings. Also, ExifTool will use Unicode::LineBreak if it's available to help preserve the column alignment of the plain text output for languages with a variable-width character set. Considerate behavior fr fr π«Ά
Right now the language support is not complete, but users are 100% welcome to help improve it by submitting their own translations. To submit a translation, follow these steps (you must have Perl installed for this, no cap):
- Download and unpack the latest Image-ExifTool full distribution.
cdinto the Image-ExifTool directory.- Run this command to make an XML file of the desired tags (eg. EXIF):
./exiftool -listx -exif:all > out.xml
- Copy this text into a file called
import.plin 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);
- Run the
import.plscript to Import the XML file, generating the'MISSING'entries for your language (eg. Russian):
perl import.pl out.xml ru
- Edit the generated language module
lib/Image/ExifTool/Lang/ru.pm, and search and replace all'MISSING'strings in the file with your translations. - Email the module (
ru.pmin this example) to exiftool@gmail.com - Thank you!! π (no seriously, that's step 8, we love you for it)
-listItem INDEXβ for list-type tags, this makes it extract only the item with the specified index π―.INDEXis0for the first item in the list. Negative indices also work, referencing items from the end of the list (so go off, count backwards). Has no effect on single-valued tags. It also applies to tag values when copying from a tag, and in-if,-pand-fileNUMarguments.-nor--printConvβ turns OFF print conversion for all tags. By default, extracted values get converted into a more human-readable format, but-ndisables that conversion and reveals the raw machine-readable values. Obsessed with the transparency tbh. Example:
> exiftool -Orientation -S a.jpg
Orientation: Rotate 90 CW
> exiftool -Orientation -S -n a.jpg
Orientation: 6
You can also disable print conversion per-tag by slapping a # character on the end of the tag name:
> exiftool -Orientation# -Orientation -S a.jpg
Orientation: 6
Orientation: Rotate 90 CW
Both of these techniques also work for disabling the inverse print conversion when writing. For example, all of these commands do the exact same thing:
> exiftool -Orientation='Rotate 90 CW' a.jpg
> exiftool -Orientation=6 -n a.jpg
> exiftool -Orientation#=6 a.jpg
-p[-] STR or FMTFILEor-printFormatβ prints output in the format specified by the given string or file πΈ. The argument is interpreted as a string unless a file of that name exists, and in that case the string gets loaded from the contents of the file. Tag names in the format string or file begin with a$symbol and may contain leading group names and/or a trailing#(which disables print conversion). Case is not significant. Braces{}may be used around the tag name to separate it from subsequent text (and you must use them if the subsequent text begins with an alphanumeric character, hyphen, underline, colon or number sign). Use$$to represent a$symbol, and$/for a newline. When the string argument is used (ie.STR), a newline is added to the end of the string unless-p-is specified or the-boption is used.
Multiple -p options may be used. 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. (To output a line beginning with #, use #[BODY]#.) 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 13.55 --
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, Shortcut tags representing multiple tags, and matching tags when the All group is specified are joined according the -sep option setting when interpolated in the string. (Note that when All is used as a group name, duplicate tags are included regardless of the Duplicates option setting.) When All is used as a tag name, a value of 1 is returned if any tag exists in the specified group, or 0 otherwise (unless the All group is also specified, in which case the values of all matching tags are joined).
The -p output iterates through the family 3 group names, with each sub-document producing additional output when combined with the -ee (ExtractEmbedded) option.
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 API MissingTagValue 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 within the -p option string.
Note that the APIRequestTagsoption is automatically set for all tags used in theFMTFILEorSTR. This lets all other tags be ignored using-API IgnoreTags=all, which results in reduced memory usage and increased speed π₯
-phpβ formats output as a PHP Array. The-g,-G,-D,-H,-l,-sepand-structoptions combine with-php, and duplicate tags are handled in the same way as with the-jsonoption. Also, the-boption may be added to output binary data, and-tmay be added to include tag table information (see-tfor details). Here's a simple example showing how this could be used in a PHP script:
<?php
eval('$array=' . `exiftool -php -q image.jpg`);
print_r($array);
?>
-plotβ writes output for all specified tags and all input files as a single SVG-formatted plot πβ¨. When you combine it with this feature, the-woption argument is a complete file name with no format codes, and the append feature may not be used. Each tag specified on the command line represents a dataset in the plot (or more, for array values or if the Split plot setting is used). Non-numerical values are ignored. Each input file may contribute multiple points to a dataset if it contains sub-documents and the-eeoption is used, or if the tag value is a delimited string of numbers (the valid delimiters are: space, comma, semicolon, tab and newline). Line, Scatter and Histogram plot types are available. See the API Plot Option and https://exiftool.org/plot.html for more details and information about the plot settings.-s[NUM]or-shortβ short output format. Prints tag names instead of descriptions. AddNUMor up to 3-soptions for even shorter formats:
-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)
It's also effective when combined with -t, -h, -X or -listx options. Less is more, and we ate π
-Sor-veryShortβ very short format. This is the same as-s2or two-soptions. Tag names are printed instead of descriptions, and no extra spaces are added to column-align values.-sep STRor-separatorβ specifies the separator string for items in list-type tags. When reading, the default is to join list items with", ". When writing, this option makes values assigned to list-type tags get split into individual items at each substring matchingSTR(otherwise they are not split by default). Space characters inSTRmatch zero or more whitespace characters in the value. Iconic π§
Note that an empty separator ("") is allowed, and it will join items with no separator when reading, or split the value into individual characters when writing. Yes, individual characters. Prepare yourself π
For pure binary output (that's -b used without -j, -php or -X, bestie), the first -sep option gives you a list-item separator, and a second -sep option gives you a terminator for the end of the list β or after each value, if it's not a list. Inside these strings you can use "\n", "\r" and "\t" to represent a newline, carriage return and tab respectively. By default? binary list items get separated by a newline, and no terminator is added. periodt. π
πΈ -sort, --sort
Sorts output by tag description, or by tag name if the -s option is in play. When you're sorting by description, the sort order depends on whatever you set with -lang (iykyk π). Without -sort, tags show up in the order you specified them on the command line, or if you didn't specify them, in the order they were extracted from the file. And by default, tags are organized by groups when combined with the -g or -G option β but you can disable that grouping with --sort.
β¨ -struct, --struct
Outputs structured XMP information instead of flattening it down to individual tags. This one slaps when combined with the XML (-X) and JSON (-j) output formats. For other output formats, XMP structures and lists get serialized into the same format as when writing structured information (see https://exiftool.org/struct.html for the details). When copying, structured tags are copied by default unless you use --struct to disable that feature β although flattened tags may still be copied by specifying them individually, unless -struct is used. And these options do literally nothing when you're assigning new values, because both flattened and structured tags may always be used when writing. π¦
π -t (-tab)
Outputs a tab-delimited list of description/values (so useful for database import, no cap). May be combined with -s to print tag names instead of descriptions, or -S to print tag values only, tab-delimited on a single line. The -t option may also be combined with -j, -php or -X to add tag table information ("table", tag "id", and "index" for cases where multiple conditional tags exist with the same ID), which lets the corresponding tag be located in the -listx output.
π₯ -T (-table)
Outputs tag values in table form. Equivalent to -t -S -q -f. fr fr, that's it, that's the whole vibe.
π¦ -v[NUM] (-verbose)
Prints verbose messages. NUM specifies the level of verbosity in the range 0-5, with higher numbers being more verbose. If NUM isn't given, then every -v option increases the level of verbosity by 1. With any level greater than 0, most other options get ignored and normal console output is suppressed unless specific tags are extracted. Using -v0 causes the console output buffer to be flushed after each line (which may be useful to avoid delays when piping exiftool output), and prints the name of each processed file when writing, plus the new file name when renaming, moving or copying. Verbose levels above -v0 do not flush after each line. Also see the -progress option. π
π -w[+][!] EXT or FMT (-textOut)
Writes console output to files with names ending in EXT, one for each source file. The output file name is obtained by replacing the source file extension (including the '.') with the specified extension (and a '.' is added to the start of EXT if it doesn't already contain one). Alternatively, a FMT string may be used to give you more control over the output file name and directory. In the format string, %d, %f and %e represent the directory, filename and extension of the source file, and %c represents a copy number which is automatically incremented if the file already exists. %d includes the trailing '/' if necessary, but %e does not include the leading '.'. For example:
-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 you add an exclamation point 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 too (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 give you 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:
- In a Windows BAT file the
"%"character is represented by"%%", so an argument like"%d%f.txt"is written as"%%d%%f.txt". - If the argument for
-wdoes not contain a valid format code (eg.%f), then it's interpreted as a file extension, but there are three different ways to create a single output file from multiple source files:
# 1. Shell redirection
exiftool FILE1 FILE2 ... > out.txt
# 2. With the -w option and a zero-width format code
exiftool -w+! %0fout.txt FILE1 FILE2 ...
# 3. With the -W option (see the -W option below)
exiftool -W+! out.txt FILE1 FILE2 ...
- The
-woption changes when used with a multi-file output format (-csvor-plot). With these, the argument of-wis a complete file name with no formatting codes, and the append feature may not be used.
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 effect. 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 lets the copy number be incremented for each processed file by using %C (upper case) instead of %c. This lets a sequential number be added to output file names, even if the names are different. For %C, a copy number of zero is not omitted the way it is with %c. A leading '-' causes the number to be reset at the start of each new directory (in the original directory structure if the files are being moved), and '+' has no effect. The number before the decimal place gives the starting index, the number after the decimal place gives the field width. To preserve synchronization with the processed file number, by default the copy number is not incremented to avoid file name collisions, so any existing same-named file will cause an error. However, using a colon instead of a decimal point causes the number to be incremented to avoid collisions with existing files. π€
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.
π -W[+|!] FMT (-tagOut)
This enhanced version of the -w option lets a separate output file be created for each extracted tag. See the -w option documentation above for the details of the basic functionality. Listed here are the differences between -W and -w: β¦
and bestie, that list is coming right up π
- π€― With
-W, a brand new output file gets created for every single extracted tag. Yeah, one each. It's a lot, bestie, but it's what you asked for. -Wsupports four extra format codes, and they're lowkey iconic:%tβ the tag name%gβ the group name%sβ the suggested extension for the output file (based on the format of the data)%oβ the value of theOriginalRawFileNameorOriginalFileNametag from the input file (extension included, obviously π )
And wait, %g can be followed by a single digit to pick the group family number (like %g1) β if you don't, family 0 is just assumed, no biggie. The substring width/position/case specifiers work with these format codes in exactly the same way as with %f and %e. Same energy, fr fr.
- Here's the tea: the argument for
-Wis treated as a file name if it has no format codes in it. (For-w, that'd be a file extension instead.) This glow-up means you can just hand it a plain file name, and when you pair that with the append feature you get a whole method to write metadata from multiple source files into a single output file β without needing shell redirection. Ate. π
For example, these 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
- Toss
-vin with-Wand instead of a verbose dump of the entire file you get a list of the tags and output file names sent to the console. Cute, right? (Unless you're appending all output to one file for each source file by using-W+with an output file FMT that doesn't contain%t,%g,%sor%oβ then, bestie, that's a different vibe.) - Individual list items get stored in separate files when
-Wis combined with-b. π«Ά But heads up: for those separate files to actually be created, you must use%cor%Cin FMT so the files get unique names. No cap, otherwise they'd just collide.
-Wext EXT,--Wext EXT(-tagOutExt) β this one sets the type of output file(s) that-Wwrites. An output file only gets written if the suggested extension matches EXT. Stack multiple-Wextoptions to write more than one type of file. And--Wextwrites all but the specified type(s), naturally. β¨-X(-xmlFormat) β use ExifTool-specific RDF/XML formatting for console output. It implies the-aoption, so duplicate tags get extracted. You can mix the formatting options-b,-D,-H,-l,-s,-sep,-structand-tin with-Xto affect the output β but note that the tag ID options (-D,-Hand-t), binary data (-b) and structured output (-struct) options are not effective for the short output (-s). Another restriction of-s: only one tag with a given group and name may appear in the output. And heads up π β the tag ID options (-D,-Hand-t) will produce non-standard RDF/XML unless the-loption is also used.
By default, -X outputs flattened tags, so add -struct if you need to preserve XMP structures. List-type tags with multiple values get formatted as an RDF Bag, but they're 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's a corresponding standard XML character set. The -b option makes binary data values get written, encoded in base64 if necessary. And the -t option adds tag table information to the output (see -t for details).
Note: this output is NOT the same as XMP, bestie. π It uses dynamically-generated property names corresponding to the ExifTool tag names with ExifTool family 1 group names as namespaces β not the standard XMP properties and namespaces. If you actually want to write XMP, use the -o option with an XMP extension for the output file. Periodt.
ποΈ Processing control ποΈ
-a,--a(-duplicates,--duplicates) β allow (-a) or suppress (--a) duplicate tag names to be extracted. By default, duplicate tags are suppressed when reading unless the-eeor-Xoptions are used or theDuplicatesoption is enabled in the configuration file. When writing, this option allows multiple Warning messages to be shown. Duplicate tags are always extracted when copying. π₯-e(--composite) β extract existing tags only β don't generate composite tags. Simple as that, bestie.-ee[NUM](-extractEmbedded) β extract information from embedded documents in EPS files, embedded EPS information and JPEG and Jpeg2000 images in PDF files, embedded MPF images in JPEG and MPO files, streaming metadata in AVCHD videos, and the resource fork of Mac OS files. It implies the-aoption. Use-g3or-G3to identify the originating document for any extracted information. Embedded documents that contain sub-documents are indicated with dashes in the family 3 group name. (eg."Doc2-3"is the 3rd sub-document of the 2nd embedded document.) And just so you know β this option may increase processing time substantially, especially for PDF files with many embedded images or videos with streaming metadata. π
When used with -ee, the -p option is evaluated for each embedded document as if it were a separate input file. This lets you, for example, generate 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. For M2TS videos, a setting of 3 causes the entire file to be parsed in search of unlisted programs which may contain timed GPS. π°οΈ
-ext[+] EXT,--ext EXT(-extension) β process only files with (-ext) or without (--ext) a specified extension. You can have multiple-extand--extoptions. A plus sign may be added (ie.-ext+) to add the specified extension to the normally processed files. EXT may begin with a leading., which gets ignored. Case is not significant. And"*"may be used to process files with any extension (or none at all), as in the last three examples:
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 just specifying "*.EXT" on the command line:
- It applies to files in subdirectories when combined with the
-roption. - The
-extoption is case-insensitive, which is super 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. Don't forget, bestie. π
-F[OFFSET](-fixBase) β fix the base for maker notes offsets. A common problem with some image editors is that offsets in the maker notes aren't adjusted properly when the file is modified. This may cause the wrong values to be extracted for some maker note entries when reading that edited file. π¬ This option lets you specify an integer OFFSET to adjust the maker notes base offset. If no OFFSET is given, ExifTool takes its best guess at the correct base. Note that exiftool will automatically fix the offsets for images which store original offset information (eg. newer Canon models). Offsets are fixed permanently if-Fis used when writing EXIF to an image. eg)
exiftool -F -exif:resolutionunit=inches image.jpg
-fast[NUM]β increase the speed of extracting information. With-fast(or-fast1), ExifTool won't scan to the end of a JPEG image to check for an AFCP or PreviewImage trailer, or past the first comment in GIF images or the audio/video data in WAV/AVI files to search for additional metadata. These speed benefits are small when reading images directly from disk, but can be substantial if you're piping images through a network connection. It also bypasses CRC validation when writing PNG images, which can be very slow. π
Want even more speed? -fast2 also causes exiftool to avoid extracting any EXIF MakerNote information, and to stop processing at the IDAT chunk of PNG images and the mdat atom of QuickTime-format files (but note that some files may store metadata after this β π). -fast3 avoids extracting metadata from the file and returns only pseudo System tags, but still reads the file header to get an educated guess at FileType. -fast4 doesn't even read the file header, and returns only System tags and a FileType based on the file extension. And -fast5 also disables generation of the Composite tags (like -e). Has no effect when writing.
Note that a separate-fastsetting may be used for evaluation of a-ifcondition, or when ordering files with the-fileOrderoption. See the-ifand-fileOrderoptions for details.
-fileOrder[NUM] [-]TAGβ set the file processing order according to the sorted value of the specified TAG. Without this option, files are processed in the order returned by the system, which is commonly by file name β but that's filesystem dependent, so, y'know. π For example, to process files in order of date:
exiftool -fileOrder DateTimeOriginal DIR
More on -fileOrder: you can stack additional -fileOrder options for secondary sort keys, bestie. Numbers get sorted numerically, and everything else gets sorted alphabetically. Any files that are missing the tag you asked for? Sorted last, sorry not sorry π
. Wanna flip the whole thing around? Prefix the tag name with a - (eg. -fileOrder -createdate). Print conversion of the sorted values is turned off with the -n option, or with a # tacked onto the end of the tag name. And heads up β other formatting options (eg. -d) do not affect the sorted values, periodt.
Lowkey important: -fileOrder can cost you a large performance penalty because it runs an extra initial processing pass over all the files π. But you can soften that blow by giving a NUM, which effectively sets the -fast level for that initial pass. Like, -fileOrder4 is fair game if TAG is a pseudo System tag. If you use multiple -fileOrder options, the extraction happens at the lowest -fast level. And no cap β files are sorted across directory boundaries if you hand it multiple input directories. π¦
-i DIR(-ignore) β Skip the directory name you name. DIR can be a single folder name or a full path, and it is case sensitive. If it's a full path, it has to match theDirectorytag exactly to be ignored. Stack multiple-ioptions to ignore more than one directory name. There's a special DIR value of"SYMLINKS"that keeps you from recursing into directories that are symbolic links when you use-r(note: this does not currently work under Windows π). Also, a value of"HIDDEN"ignores files with names starting with a.(ie. hidden files on Unix systems) while scanning a directory. π-if[NUM] EXPRβ Set a condition that gets checked before each FILE is processed. EXPR is a Perl-like logic expression with tag names prefixed by$symbols. It's evaluated with the tags from each FILE in turn, and the file only gets processed if the expression comes back true. Unlike Perl variable names, tag names are not case sensitive and may contain a hyphen. Also, tag names can have leading group names separated by colons, and/or a trailing#character to disable print conversion. The expression$GROUP:allevaluates to 1 if any tag exists in the specified"GROUP", or 0 otherwise (peep note 2 below). When you use multiple-ifoptions, all conditions must be satisfied to process the file. It returns an exit status of 2 if all files fail the condition. A few examples, served fresh:
# 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 a NUM to the -if option makes a separate processing pass run to evaluate EXPR at a -fast level given by NUM (check the -fast option docs for the deets). Without NUM, only one processing pass happens, at the level specified by the -fast option. So like, -if5 is possible if EXPR only uses pseudo System tags, and it can significantly speed up processing if enough files fail the condition. Speed slay π₯
The expression has access to the current ExifTool object through $self, and these special functions are available to let you short-circuit 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 the current directory
after this file (not compatible with -fileOrder)
Notes, bestie β read them fr fr:
- The
-nand-boptions also apply to tags used in EXPR. - The API
RequestTagsoption is automatically set for all tags used in the-ifcondition. - Tags in the string are interpolated in a similar way to
-pbefore 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"$", and regular expressions ending in$/must use$$/instead. - The condition accesses only tags from the file being processed unless the
-fileNUMoption is used to read an alternate file and the corresponding family 8 group name is specified for the tag. See the-fileNUMoption details for more information. - The
-a(Duplicates) option is implied when-ifis used without a fast NUM, and the values of duplicate tags are accessible by specifying a group name in the expression (such as a family 4 instance number, eg.$Copy1:TAG,$Copy2:TAG, etc). - A special
"OK"UserParam is available to test the success of the previous command when-executewas used, and may be used like any other tag in the condition (ie."$OK"). - The values of undefined tags in the expression are affected by the
-fand-moptions unless the APIUndefTagsoption is also set. - The condition fails if a Perl error occurs. This could happen for instance if an undefined value (eg. a missing tag) is used improperly.
-m(-ignoreMinorErrors) β Ignore minor errors and warnings. This lets you write to files with minor errors and disables some validation checks that could throw minor warnings. Generally, minor errors/warnings mean there's a problem that usually won't cause loss of metadata if you ignore it. But there are exceptions, so ExifTool leaves the final call up to you. Minor errors and warnings are flagged by[minor]at the start of the message. Warnings which affect processing when ignored are flagged by[Minor](with a capital"M"). Note that this makes missing values in-tagsFromFile,-p,-ifand-fileNUMstrings get set to an empty string rather than an undefined value (but this may be avoided for-ifusing the APIUndefTagsoption). π«Ά-o OUTFILEorFMT(-out) β Set the output file or directory name when writing information. Without this option, when any "real" tags get written, the original file is renamed to"FILE_original"and output is written toFILE. When you're writing onlyFileNameand/orDirectory"pseudo" tags,-omakes the file get copied instead of moved β but directories specified for either of those tags take precedence over whatever-osays. π
OUTFILE may be "-" to write to stdout. The output file name can also be a FMT string where %d, %f and %e represent the directory, file name and extension of FILE. Also, %c can be used to add a copy number. See the -w option for FMT string examples.
The output file is treated as 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 -overwrite_original with -o makes the original source file get erased after the output file is successfully written. π³
A special feature of this option lets you create certain types of files from scratch, or with the metadata from another type of file. These file types can be created this way:
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 combo of information in FILE (as if the -tagsFromFile option was used) plus 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. Iconic β¨
-overwrite_originalβ Overwrite the original FILE (instead of preserving it by adding"_original"to the file name) when writing information to an image. > Caution: only use this option if you already have separate backup copies of your image files. The overwrite is implemented by renaming a temporary file to replace the original. This deletes the original file and replaces it with the edited version in a single operation. When combined with-o, this option makes the original file get deleted if the output file was successfully written (ie. the file is moved instead of copied). π¨-overwrite_original_in_placeβ Same energy as-overwrite_original, except an extra step is added to let the original file attributes be preserved. Like, on a Mac this preserves the original file creation date, type, creator, label color, icon, Finder tags, other extended attributes, and hard links to the file (but note the Mac OS resource fork is always preserved unless specifically deleted with"-rsrc:all="). This is implemented by opening the original file in update mode and replacing its data with a copy of a temporary file before deleting the temporary. That extra step means slower performance, so you should use-overwrite_originalinstead unless you need this. π
Note that this option reverts to the behaviour of the -overwrite_original option when you're also writing the FileName and/or Directory tags.
-P(-preserve) β Preserve the filesystem modification date/time (FileModifyDate) of the original file when writing. Note that some filesystems store a creation date (ie.FileCreateDateon Windows and Mac systems) which is not affected by this option. This creation date is preserved on Windows systems whereWin32API::FileandWin32::APIare available, regardless of this setting. For other systems, the-overwrite_original_in_placeoption may be used if necessary to preserve the creation date. The-Poption is superseded by any value written to theFileModifyDatetag. π-password PASSWDβ Give a password so password-protected PDF documents can be processed. If a password is required but not given, a warning is issued and the document is not processed. This option is ignored if a password isn't required. π-progress[NUM][:[TITLE]]β bestie, this one shows you the progress while it's grinding through your files π«Ά Without a colon,-progressdrops a progress count in brackets right after the name of every processed file, giving you the current file number and the total number of files. It also implies the-v0option, so the names of processed files get printed when writing too. When you pair it with-if, the total count includes all files before the condition is applied, but files that fail the condition won't have their names printed. And if you throw inNUM, the progress shows up everyNUMinput files.
If it's followed by a colon (like -progress:), it sets the console window title according to the TITLE string you give it. No TITLE? Then it assumes a default of "ExifTool %p%%". Inside that 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 "##" (where "##" is an integer specifying the bar width in characters, or 20 characters by default if "##" is omitted), and %% is a % character. You can combine it 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.)
-q(-quiet) β quiet processing π One-qsuppresses normal informational messages, and a second-qsuppresses warnings as well. Error messages can not be suppressed, although minor errors may be downgraded to warnings with the-moption, which may then be suppressed with"-q -q".-r[.](-recurse) β recursively process files in subdirectories π¦ Only meaningful if FILE is a directory name. Subdirectories whose names begin with"."are not processed unless"."is added to the option name (ie.-r.or-recurse.). By default,exiftoolwill also follow symbolic links to directories if supported by the system, but this may be disabled with"-i SYMLINKS"(see the-ioption for details). Combine this with-extoptions to control the types of files processed.-scanForXMPβ scan all files (even unsupported formats) for XMP information unless found already π When combined with the-fastoption, only unsupported file types are scanned. Warning: it can be time consuming to scan large files.-u(-unknown) β extract values of unknown tags β¨ Add another-uto also extract unknown information from binary data blocks. This option applies to tags with numerical tag ID's, and causes tag names like"Exif_0xc5d9"to be generated for unknown information. It has no effect on information types which have human-readable tag ID's (such as XMP), since unknown tags are extracted automatically from these formats.-U(-unknown2) β extract values of unknown tags as well as unknown information from some binary data blocks π This is the same as two-uoptions.-wm MODE(-writeMode) β set mode for writing/creating tags π MODE is a string of one or more characters from the list below. The default write mode is"wcg".wβ Write existing tagscβ Create new tagsgβ 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).
-z(-zip) β when reading, causes information to be extracted from.gzand.bz2compressed images (only one image per archive; requiresgzipandbzip2to be available) π When writing, causes compressed information to be written if supported by the metadata format (eg. PNG supports compressed textual metadata, JXL supports compressed EXIF and XML, and MIE supports any compressed metadata), disables the recommended padding in embedded XMP (saving2424bytes when writing XMP in a file), and writes XMP in shorthand format β the equivalent of setting the APICompress=1andCompact="NoPadding,Shorthand".
π Other options π
-@ ARGFILEβ read command-line arguments from the specified file π The file contains one argument per line (NOT one option per line β some options require additional arguments, and all arguments must be placed on separate lines). Blank lines and lines beginning with"#"are ignored (unless they start with"#[CSTR]", in which case the rest of the line is treated as a C string, allowing standard C escape sequences such as"\n"for a newline). White space at the start of a line is removed. Normal shell processing of arguments is not performed, which among other things means that arguments should not be quoted and spaces are treated as any other character. ARGFILE may exist relative to either the current directory or theexiftooldirectory unless an absolute pathname is given.
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.
-k(-pause) β pause with the message"-- press any key --"or"-- press RETURN --"(depending on your system) before terminating π§ This option is used to prevent the command window from closing when run as a Windows drag and drop application.-list,-listw,-listf,-listr,-listwf,-listg[NUM],-listd,-listx,-listgeoβ print a list of all valid tag names (-list), all writable tag names (-listw), all supported file extensions (-listf), all recognized file extensions (-listr), all writable file extensions (-listwf), all tag groups [in a specified family] (-listg[NUM]), all deletable tag groups (-listd), an XML database of tag details including language translations (-listx), or the Geolocation database (-listgeo) π The-list,-listwand-listxoptions may be followed by an additional argument of the form"-GROUP:All"to list only tags in a specific group, where"GROUP"is one or more family 0-2 group names (excepting EXIF IFD groups) separated by colons. With-listg, NUM may be given to specify the group family, otherwise family 0 is assumed. The-lor-voption may be combined with-listf,-listror-listwfto add file descriptions to the list. The-langoption may be combined with-listxto output descriptions in a single language, and the-sortand/or-langoptions may be combined with-listgeo(installation of the alternate database is required for the additional languages). Also, the APIGeolocMinPop,GeolocFeatureandGeolocAltNamesoptions apply to the-listgeooutput. Here are some examples:
-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
-listgeo -lang de # list geolocation database in German
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 'flags' and 'struct' attributes 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 also given, and flattened structure tags are indicated by a Flattened flag with 'struct' giving the ID of the parent structure.
Note that none of the -list options require an input FILE. π
-verβ printexiftoolversion number β The-voption may be added to print addition system information (see the README file of the full distribution for more details about optional libraries), or-v2to also list the Perl include directories.--β indicates the end of options π Any remaining arguments are treated as file names, even if they begin with a dash ("-").
π Special features π
-diff FILE2
Compare metadata in FILE with FILE2 π₯ The FILE2 name may include filename formatting codes (see the -w option). All extracted tags from the files are compared, but the extracted tags may be controlled by adding -TAG or --TAG options. For example, below is a command to compare all the same-named files in two different directories, ignoring the System tags:
exiftool DIR1 -diff DIR2/%f.%e --system:all
The -g and -G options may be used to organize the output by the specified family of groups, with -G1 being the default. The -a option is implied. Adding -v includes a count of the number of tags that are the same in each group, and -v2 also indicates when zero tags were the same. The following text formatting options are valid when -diff is used: -c, -charset, -d, -E, -ec, -ex, -L, -lang, -n, -s, -sep, -struct and -w.
-geotag TRKFILE
Geotag images from the specified GPS track log file πΊοΈπ Using the -geotag option is equivalent to writing a value to the "Geotag" tag. The GPS position is interpolated from the track at a time specified by the value written to the "Geotime" tag. If "Geotime" is not specified, the value is copied from "SubSecDateTimeOriginal#" if it exists, otherwise "DateTimeOriginal#" (the "#" is added to copy the unformatted value, avoiding potential conflicts with the -d option). For example, the following two commands are equivalent if SubSecDateTimeOriginal exists in the file:
exiftool -geotag trk.log image.jpg
exiftool -geotag trk.log "-Geotime<SubSecDateTimeOriginal#" image.jpg
okay so if the Geotime value has no time zone in it, bestie, we just assume ur local system timezone, that's the vibe π
And writing Geotime makes exiftool write ALL of these tags (but only if they can actually be calculated from the track log, and only if the destination metadata format supports them, so no promises okay):
GPSLatitudeGPSLatitudeRefGPSLongitudeGPSLongitudeRefGPSAltitudeGPSAltitudeRefGPSDateStampGPSTimeStampGPSDateTimeGPSTrackGPSTrackRefGPSSpeedGPSSpeedRefGPSImgDirectionGPSImgDirectionRefGPSMeasureModeGPSDOPGPSPitchGPSRollGPSCoordinatesAmbientTemperatureCameraElevationAngle
By default, in image files these tags get created in EXIF, and updated in XMP only if they already exist. Different energy for QuickTime-format files tho: there GPSCoordinates gets created in the preferred location (ItemList by default) and in XMP too. π
But wait β u can be picky! EXIF:Geotime, XMP:Geotime or QuickTime:Geotime can be specified to write only to one group. Also ItemList:Geotime, Keys:Geotime or UserData:Geotime may be used to write to a specific location in QuickTime-format files. π―
Heads up bestie:GPSPitchandGPSRollare non-standard, and they require user-defined tags in order to be written. Like, they will not just show up, ok?
The Geosync tag may be used to specify a time correction which gets applied to each Geotime value, for synchronization with GPS time. For example, this command compensates for image times that are 1 minute and 20 seconds behind GPS:
exiftool -geosync=+1:20 -geotag a.log DIR
Advanced Geosync features allow a piecewise linear time drift correction and synchronization from previously geotagged images. See geotag.html in the full ExifTool distribution for more info, iykyk β¨
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 lowkey important: in this case TRKFILE must be quoted on most systems (with the notable exception of Windows) to prevent filename expansion. Like this:
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
- 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 info about geotag configuration options. π
The API Geolocation option may be set to the value geotag to also write the name, province/state and country of the nearest city while geotagging. See https://exiftool.org/geolocation.html for the details. ποΈ
πΈ -globalTimeShift SHIFT πΈ
Shift all formatted date/time values by the specified amount when reading. Does not apply to unformatted (-n) output, so don't come for it.
SHIFT takes the same form as the date/time shift when writing (see Image::ExifTool::Shift.pl for details), with a negative shift being indicated with a minus sign (-) at the start of the SHIFT string.
For example:
# 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
π¦ -use MODULE π¦
Add features from the specified plug-in MODULE. Currently, the MWG module is the only plug-in module distributed with exiftool. This module adds read/write support for tags as recommended by the Metadata Working Group. As a convenience, -use MWG is assumed if the group name prefix starts with MWG: exactly for any requested tag. See the MWG Tags documentation for more details.
Ngl, this one is a commitment: this option is not reversible, and it stays in effect until the application terminates, even across the -execute option. So it's giving permanent. π
π§° Utilities π§°
-restore_original and -delete_original[!]
These utility options automate the maintenance of the _original files created by exiftool. They have no effect on files without an _original copy. π
The -restore_original option restores the specified files from their original copies by renaming the _original files to replace the edited versions. For example, this command restores the originals of all JPG images in directory DIR:
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, this 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 they can be combined with options such as-ext,-if,-r,-qand-v. No cap. π«Ά
π 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. Efficiency slay. β‘
-api [OPT[[^]=[VAL]]]
Set ExifTool API option. OPT is an API option name. The option value is set to 1 if =VAL is omitted. If just VAL is omitted, the option value is set to undef if = is used, or an empty string with ^=. If OPT is not specified a list of available options is returned.
The option name is not case sensitive, but the option values are. See Image::ExifTool Options for option details. This overrides API options set via the config file.
Note that the exiftool app sets some API options internally, and attempts to change these via the command line will have no effect. Sorry babes, that door is locked. π
-common_args
Specifies that all arguments following this option are common to all executed commands when -execute is used. This and the -config option are the only options that may not be used inside a -@ ARGFILE.
By definition this option and its arguments MUST come after all other options on the command line. It's the last one at the function, literally. π
-config CFGFILE
Load specified configuration file instead of the default .ExifTool_config. If used, this option must come before all other arguments on the command line and applies to all -execute'd commands.
This file is used to create user-defined tags as well as set default ExifTool options. The CFGFILE must exist relative to the current working directory or the exiftool application directory unless an absolute path is specified.
Loading of the default config file may be disabled by setting CFGFILE to an empty string (ie. ""). See https://exiftool.org/config.html and config_files/example.config in the full ExifTool distribution for details about the configuration file syntax. π
-echo[NUM] TEXT
Echo TEXT to stdout (-echo or -echo1) or stderr (-echo2). Text is output as the command line is parsed, before the processing of any input files.
NUM may also be 3 or 4 to output text (to stdout or stderr respectively) after processing is complete. For -echo3 and -echo4, ${status} may be used in the TEXT string to represent the numerical exit status of the command (see "EXIT STATUS"). π
-efile[NUM][!] TXTFILE
Save the names of files giving errors (NUM missing or 1), files that were unchanged (NUM is 2), files that fail the -if condition (NUM is 4), files that were updated (NUM is 8), files that were created (NUM is 16), or any combination thereof by summing NUM (eg. -efile3 is the same as having both -efile and -efile2 options with the same TXTFILE).
By default, file names are appended to any existing TXTFILE, but TXTFILE is overwritten if an exclamation point is added to the option (eg. -efile!). Saves the name of the file specified by the -srcfile option if applicable. ποΈ
-execute[NUM]
Execute command for all arguments up to this point on the command line (plus any arguments specified by -common_args). The result is as if the commands were executed as separate command lines (with the exception of the -config and -use options which remain in effect for subsequent commands). Allows multiple commands to be executed from a single command line. π€―
NUM is an optional number that is echoed in the {ready} message when using the -stay_open feature. If a NUM is specified, the -q option no longer suppresses the output {readyNUM} message.
-fileNUM ALTFILE
Read tags from an alternate source file. Among other things, this allows tags from different files to be compared and combined using the -if and -p options. NUM is any string of digits. Tags from alternate files are accessed via the corresponding family 8 group name (eg. File1:TAG for the -file1 option, File2:TAG for -file2, etc).
ALTFILE may contain filename formatting codes like the -w option (%d, %f, etc), and/or tag names with a leading $ symbol to access tags from the source file in the same way as the -p option (so any other dollar symbol in the file name must be doubled, eg. money$$.jpg). πΈ
For example, assuming that the OriginalFileName tag has been set in the edited file, a command to copy Rights from the original file could look like this:
exiftool -file1 '$originalfilename' '-rights<file1:rights' edited.jpg
Subtle note π: If a-tagsFromFileoption is used, tags in the ALTFILE argument come from the SRCFILE that applies to the first argument accessing tags from the correspondingFileNUMgroup.
ALTFILE may also be @ to access tags from the specified FILE, which may be useful when the -srcfile option is used to process a different source file.
User-defined Composite tags may access tags from alternate files using the appropriate (case-sensitive) family 8 group name.
The -fast option, if used, also applies to processing of the alternate files. β¨
-list_dirβ bestie, this one makes directories get treated like regular files when reading AND writing, so you list the directories themselves instead of peeking inside them π. Like, imagine you want a fakels -lavibe on Mac/Linux. You could approximate it with this exiftool command:
exiftool -list_dir -T -ls-l -api systemtags -fast5 .* *
(And yes, let's break that down π
: -T makes the output tab-separated columns, -ls-l is a shortcut tag, the API SystemTags option is required to pull out some necessary tags, and -fast5 is tacked on for speed since literally only system tags are being extracted.)
-srcfile FMTβ picks a different source file to process, based on the name of the original FILE β¨. Super handy in those niche situations where you're processing related preview images or sidecar files. TheFMTsyntax works exactly like it does for the-woption. Important tho: file nameFMTstrings for all options are based on the original FILE from the command line β NOT on the name of the source file that-srcfilepoints at π.
Say you want to copy metadata from NEF files onto their matching JPG previews in a directory that's also got other JPGs hangin' around:
exiftool -ext nef -tagsfromfile @ -srcfile %d%f.jpg dir
If you specify more than one -srcfile option, the files get tested in order and the first one that exists gets processed π. And if none of the source files exist yet? Then exiftool just uses the first -srcfile you specified. Queen of fallbacks π.
You can use a FMT of "@" to mean the original FILE β which is lowkey useful when you're stacking multiple -srcfile options (like, falling back to processing the original FILE if no sidecar exists).
When this option is used, two special UserParam tags get generated β OriginalFileName and OriginalDirectory β so you still have access to the original FILE name and directory πΈ.
-stay_open FLAGβ okay so ifFLAGis1or"True"(case insensitive, bestie), exiftool keeps reading from the-@ARGFILE even after it hits end-of-file π€―. This lets calling applications pre-load exiftool and dodge the overhead of loading it fresh for every single command. Iconic for performance. The procedure goes like this:- Run
"exiftool -stay_open True -@ ARGFILE", where ARGFILE is the name of an existing (possibly empty) argument file, or"-"to pipe arguments from standard input. - Write exiftool command-line arguments to ARGFILE, one argument per line (details live in the
-@option). - Write
"-execute\n"to ARGFILE, where"\n"is a newline sequence. (Note: you may need to flush your write buffers here if you're using buffered output π«Ά.) ExifTool will then execute the command with all the arguments it's received so far, send a"{ready}"message to stdout when it's done (unless-qor-Tis used), and go right back to reading arguments for the next command from ARGFILE. To help with command/response synchronization, any number you append to the-executeoption gets echoed in the"{ready}"message. So like,"-execute613"gives you"{ready613}". When that number's added,-qno longer suppresses the"{ready}"message. (Also, peep the-echo3and-echo4options for extra ways to pass signals back to your application π.) - Repeat steps 2 and 3 for each command.
- Write
"-stay_open\nFalse\n"(or"-stay_open\n0\n") to ARGFILE when you're done. That makes exiftool process any remaining command-line args and then exit normally π .
- Run
Oh and the input ARGFILE can be swapped out at any time before step 5 β just write these lines to the currently open ARGFILE:
-stay_open
True
-@
NEWARGFILE
That closes ARGFILE and keeps NEWARGFILE open. (Without the -stay_open there, exiftool would go back to reading arguments from ARGFILE once it hit the end of NEWARGFILE β sneaky!)
Note: when writing arguments to a disk file, there's a delay of up to0.01seconds after writing"-execute\n"before exiftool starts processing the command β. You can skip that delay by sending aCONTsignal to the exiftool process right after writing"-execute\n". (There's no delay at all when writing args through a pipe with"-@ -", so the signal isn't needed for that technique β¨.)
-userParam PARAM[[^]=[VAL]]β sets a user parameter, bestie π.PARAMis literally any arbitrary user parameter name you want. This hooks into the APIUserParamoption (check theImage::ExifToolOptions documentation for the deets), and it gives you a way to access user-defined parameters inside arguments to the-if,-pand-fileNUMoptions β just like they were any other tag π. If you append a hash tag ("#") toPARAM(like"-userParam MyTag#=yes"), it also makes the parameter get extracted as a normal tag in theUserParamgroup. Same energy as the-apioption: the parameter value becomes1if=VALis omitted,undefif onlyVALis omitted with"=", or an empty string ifVALis omitted with"^=".
exiftool -p '$test from $filename' -userparam test=Hello FILE
β¨ Advanced formatting feature β¨
Okay this part is so cool π. There's an advanced formatting feature that lets you modify the value of any tag interpolated inside a -if, -p or -fileNUM argument β or inside a -tagsFromFile redirection string π₯.
Inside those strings, tag names get prefixed with a "$" symbol, and you can apply an arbitrary Perl expression to the tag value by wrapping braces around the tag name and dropping the expression after the name, separated by a semicolon. Like so: "${TAG;EXPR}" β¨.
The expression operates on the tag value through the default input variable ($_), and it has full access to the ExifTool API via the current ExifTool object ($self) and the tag key ($tag) π. It can contain any valid Perl code β including translation ("tr///") and substitution ("s///") operations β but heads up: braces inside the expression must be balanced π. And if the expression doesn't modify $_, you just get the original tag value back. Slay.
Check it: this example prints the camera Make with spaces turned into underlines, and any run of consecutive underlines squished down to a single one:
exiftool -p '${make;tr/ /_/;s/__+/_/g}' image.jpg
You can add an "@" after the tag name to make the expression act on individual list items for list-type tags β which hugely simplifies list processing π¦. Set $_ to undef to yeet an item from the list. For example, this command returns all subjects that don't contain the string "xxx":
exiftool -p '${subject@;$_=undef if /xxx/}' image.jpg
A default expression of "tr(/\\?*:|"<>\0)()d" is assumed when the expression is empty (ie. "${TAG;}") π
. That strips out the characters / \ ? * : | < > and null from the printed value. (Those characters are illegal in Windows file names, so this feature comes in clutch when tag values end up in file names.)
Note that the expression is not evaluated for undefined (non-existent) tags β and those might have other values if either the-mor-fcommand-line option, or the APIMissingTagValueoption, is used π.
π§ Helper functions π§
Okay so β function names here are case sensitive, bestie. Don't play with that π .
"DateFmt"
Makes reformatting individual date/time values way easier πΈ. This function acts on a standard EXIF-formatted date/time value in $_ and formats it according to your specified format string (peep the -d option). And to avoid trying to reformat an already-formatted date/time value, you must add a "#" to the tag name (like in the example below) if you're also using the -d option. For example:
exiftool -p '${createdate#;DateFmt("%Y-%m-%d_%H%M%S")}' a.jpg
"ShiftTime"
Shifts an 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 all the 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, using a separator specified by the -sep option π. This one is most useful when you're copying list-type tags. For example, this command can remove duplicate Keywords:
exiftool -sep '##' '-keywords<${keywords;NoDups}' a.jpg
The -sep option is necessary here so the string gets split back into individual list items when writing to a list-type tag π.
There's an optional flag argument you can set to 1 that makes "NoDups" set $_ to undef if no duplicates existed β which stops the file from being rewritten for absolutely no reason π:
exiftool -sep '##' '-keywords<${keywords;NoDups(1)}' a.jpg
ExifTool 12.64 adds an API NoDups option which makes the NoDups helper function largely redundant π β it has all the functionality except the ability to avoid rewriting the file when there are no duplicates, but it's got the advantage that duplicates can be removed when accumulating list items from multiple sources. An equivalent to the above commands using this feature would be:
exiftool -tagsfromfile @ -keywords -api nodups a.jpg
"SetTags"
Used to set tags in extracted images π. With no arguments, it copies all tags from the source file to the embedded image:
exiftool -p '${previewimage;SetTags}' -b a.arw > preview.jpg
You can add arguments to copy or set specific tags π. Arguments take exactly the same form as those on the command line when copying or writing tags β except without the leading dash. For example:
exiftool -p '${previewimage;SetTags("comment=test","title<filename")}' ...
πͺ WINDOWS UNICODE FILE NAMES π
okay so here's the Windows tea, bestie, and it's a lot π«
On Windows, command-line arguments are specified using the current code page and get recoded automatically to the system code page. That recoding does not happen for arguments inside ExifTool arg files, so by default filenames in arg files use the system code page. And here's the sad part: these code pages aren't complete character sets, so not every file name can even be represented. π
ExifTool 9.79 and later let you specify the file name encoding with -charset filename=CHARSET, where CHARSET is the name of a valid ExifTool character set β preferably UTF8 (peep the -charset option for the complete list). Setting this triggers the use of Windows wide-character i/o routines, which gives you support for most Unicode file names (see note 4). But ngl, it is not trivial to pass properly encoded file names on the Windows command line (see https://exiftool.org/faq.html#Q18 for the details), so the recommended move β if you can β is to put them in a UTF-8 encoded -@ argfile and use -charset filename=utf8. π
A warning is issued if a specified filename contains special characters and the filename character set wasn't provided. But you can silence that warning by setting -charset filename="", and ExifTool may still function correctly if the system code page matches the character set used for the file names. no cap.
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. she just knows β¨
The filename character set applies to the FILE arguments as well as the 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. And the -charset filename= option must come before the -@ option to be effective β but with respect to other options, the order doesn't matter. π¦
π Notes (read these bestie)
FileNameandDirectorytag values still use the same encoding as other tag values, and are converted to/from the filename character set when writing/reading if specified.- Unicode support is not yet implemented for other Windows-based systems like Cygwin. π
- See "WRITING READ-ONLY FILES" below for a note about editing read-only files with Unicode names.
- Unicode file names with surrogate pairs (code points over
U+FFFF) still cause problems. π
π WRITING READ-ONLY FILES β¨
So generally speaking, ExifTool may be used to write metadata to read-only files provided that the user has write permission in the directory. That's the vibe. But there are three cases where file write permission is also required:
- When using the
-overwrite_original_in_placeoption. - When writing only pseudo System tags (eg.
FileModifyDate). - On Windows if the file has Unicode characters in its name, and a) the
-overwrite_originaloption is used, or b) the_originalbackup 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 -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/" ...
π READING EXAMPLES πΈ
Note: Beware when cutting and pasting these examples into your terminal! Some characters such as single and double quotes and hyphens may have been changed into similar-looking yet functionally-different characters by the text formatter used to display this documentation. Also note that in the Windows cmd shell, double quotes must be used instead of the single quotes used in the examples. β οΈ
exiftool -a -u -g1 a.jpg
Print all meta information in an image, including duplicate and unknown tags, sorted by group (for family 1). For performance reasons, this command may not extract all available metadata. (Metadata in embedded documents, metadata extracted by external utilities, and metadata requiring excessive processing time may not be extracted). Add -ee3 and -api RequestAll=3 to the command to extract absolutely everything available. π₯
exiftool -common dir
Print common meta information for all images in dir. -common is a shortcut tag representing common EXIF meta information. cute and efficient π
exiftool -T -createdate -aperture -shutterspeed -iso dir > out.txt
List specified meta information in tab-delimited column form for all images in dir to an output text file named out.txt.
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 two image files.
exiftool -r -w .txt -common pictures
Recursively extract common meta information from files in pictures directory, writing text output to .txt files with the same names.
exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg
Save thumbnail image from image.jpg to a file called thumbnail.jpg. π
exiftool -b -JpgFromRaw -w _JFR.JPG -ext NEF -r .
Recursively extract JPG image from all Nikon NEF files in the current directory, adding _JFR.JPG for the name of the output JPG files.
exiftool -a -b -W %d%f_%t%-c.%s -preview:all dir
Extract all types of preview images (ThumbnailImage, PreviewImage, JpgFromRaw, etc.) from files in directory dir, adding the tag name to the output preview image file names.
exiftool -d '%r %a, %B %e, %Y' -DateTimeOriginal -S -s -ext jpg .
Print formatted date/time for all JPG files in the current directory.
exiftool -IFD1:XResolution -IFD1:YResolution image.jpg
Extract image resolution from EXIF IFD1 information (thumbnail image IFD).
exiftool '-*resolution*' image.jpg
Extract all tags with names containing the word "Resolution" from an image.
exiftool -xmp:author:all -a image.jpg
Extract all author-related XMP information from an image.
exiftool -xmp -b a.jpg > out.xmp
Extract complete XMP data record intact from a.jpg and write it to out.xmp using the special XMP tag (see the Extra tags in Image::ExifTool::TagNames).
exiftool -p '$filename has date $dateTimeOriginal' -q -f dir
Print one line of output containing the file name and DateTimeOriginal for each image in directory dir.
exiftool -ee3 -p '$gpslatitude, $gpslongitude, $gpstimestamp' a.m2ts
Extract all GPS positions from an AVCHD video. π
exiftool -icc_profile -b -w icc image.jpg
Save complete ICC_Profile from an image to an output file with the same name and an extension of .icc.
exiftool -htmldump -w tmp/%f_%e.html t/images
Generate HTML pages from a hex dump of EXIF information in all images from the t/images directory. The output HTML files are written to the tmp directory (which is created if it didn't exist), with names of the form 'FILENAME_EXT.html'.
exiftool -a -b -ee -embeddedimage -W Image_%.3g3.%s file.pdf
Extract embedded JPG and JP2 images from a PDF file. The output images will have file names like Image_#.jpg or Image_#.jp2, where # is the ExifTool family 3 embedded document number for the image. π
β¨ WRITING EXAMPLES β¨
okay bestie before we dive in, real talk: those quotes? NECESSARY π
any argument that's got special characters in it like > , < or literally any white space needs to be wrapped up cozy. The exact quoting technique is shell dependent (iykyk), but everything down here works for most Unix shells π. On Windows cmd shell though? bestie you gotta use double quotes instead, like -Comment="This is a new comment". periodt.
exiftool -tagsfromfile src.jpg -exif:all --subifd:all dst.jpg
Write new comment to a JPG image (replaces any existing comment). ποΈ
exiftool -comment= -o newdir -ext jpg .
Remove comment from all JPG images in the current directory, writing the modified images to a new directory. (not me moving things around, respectfully π«Ά)
exiftool -keywords=EXIF -keywords=editor dst.jpg
Replace existing keyword list with two new keywords (EXIF and editor). out with the old, in with the new slay β¨
exiftool -Keywords+=word -o newfile.jpg src.jpg
Copy a source image to a new file, and add a keyword (word) to the current list of keywords. no deleting, just β¨addingβ¨
exiftool -exposurecompensation+=-0.5 a.jpg
Decrement the value of ExposureCompensation by 0.5 EV. Heads up bestie: += with a negative value is how you decrement, because the -= operator is reserved for conditional deletion (see the next example, it's giving βοΈ).
exiftool -credit-=xxx dir
Delete Credit information from all files in a directory where the Credit value was "xxx". bye felicia π
exiftool -xmp:description-de='kühl' -E dst.jpg
Write alternate language for XMP:Description, using HTML character escaping to input special characters. multilingual icon behavior π
exiftool -all= dst.jpg
Delete all meta information from an image. π§Ή
Note: you should NOT do this to RAW images (except DNG) since proprietary RAW image formats often contain information in the makernotes that is necessary for converting the image. this is the "do not pass go" of exiftool, bestie, do not do it π
exiftool -all= -comment='lonely' dst.jpg
Delete all meta information from an image and add a comment back in. (Note that the order is IMPORTANT: -comment='lonely' -all= would also delete the new comment. order matters, always has, always will π
)
exiftool -all= --jfif:all dst.jpg
Delete all meta information except JFIF group from an image. selective β¨
exiftool -Photoshop:All= dst.jpg
Delete Photoshop meta information from an image (note that the Photoshop information also includes IPTC). no cap, they're bundled together π
exiftool -r -XMP-crss:all= DIR
Recursively delete all XMP-crss information from images in a directory. go deep, delete everything π³οΈ
exiftool '-ThumbnailImage<=thumb.jpg' dst.jpg
Set the thumbnail image from specified file. (Note: the quotes are necessary to prevent shell redirection β the shell would lowkey eat it otherwise π΄)
exiftool '-JpgFromRaw<=%d%f_JFR.JPG' -ext NEF -r .
Recursively write JPEG images with filenames ending in _JFR.JPG to the JpgFromRaw tag of like-named files with extension .NEF in the current directory. (This is the inverse of the -JpgFromRaw command of the "READING EXAMPLES" section above β full circle moment π¦)
exiftool -DateTimeOriginal-='0:0:0 1:30:0' dir
Adjust original date/time of all images in directory dir by subtracting one hour and 30 minutes. (This is equivalent to -DateTimeOriginal-=1.5. See Image::ExifTool::Shift.pl for details. time travel but make it metadata β°)
exiftool -createdate+=3 -modifydate+=3 a.jpg b.jpg
Add 3 hours to the CreateDate and ModifyDate timestamps of two images. β±οΈ
exiftool -AllDates+=1:30 -if '$make eq "Canon"' dir
Shift the values of DateTimeOriginal, CreateDate and ModifyDate forward by 1 hour and 30 minutes for all Canon images in a directory. (The AllDates tag is provided as a shortcut for these three tags, allowing them to be accessed via a single tag. one tag to rule them all π)
exiftool -xmp:city=Kingston image1.jpg image2.nef
Write a tag to the XMP group of two images. (Without the xmp: this tag would get written to the IPTC group since City exists in both, and IPTC is preferred by default. so specify your group bestie, don't leave it to the algorithm π)
exiftool -LightSource-='Unknown (0)' dst.tiff
Delete LightSource tag only if it is unknown with a value of 0. conditional βοΈ
exiftool -whitebalance-=auto -WhiteBalance=tung dst.jpg
Set WhiteBalance to Tungsten only if it was previously Auto. the glow-up is conditional π
exiftool -comment-= -comment='new comment' a.jpg
Write a new comment only if the image doesn't have one already. no overwriting, we respect boundaries π«Ά
exiftool -o %d%f.xmp dir
Create XMP meta information data files for all images in dir. β¨
exiftool -o test.xmp -owner=Phil -title='XMP File'
Create an XMP data file only from tags defined on the command line. bespoke, handmade, artisanal π
exiftool '-ICC_Profile<=%d%f.icc' image.jpg
Write ICC_Profile to an image from a .icc file of the same name. πΈ
exiftool -hierarchicalkeywords='{keyword=one,children={keyword=B}}'
Write structured XMP information. See https://exiftool.org/struct.html for more details. nesting, but make it metadata πͺ
exiftool -trailer:all= image.jpg
Delete any trailer found after the end of image (EOI) in a JPEG file. A number of digital cameras store a large PreviewImage after the JPEG EOI, and the file size may be reduced significantly by deleting this trailer. See the JPEG Tags documentation for a list of recognized JPEG trailers. slimming down the file, we love a glow-down when it comes to bytes π₯
π COPYING EXAMPLES π
these next ones? they demonstrate the ability to copy tag values between files. it's giving tag teleportation π§
exiftool -tagsFromFile src.cr2 dst.jpg
Copy the values of all writable tags from src.cr2 to dst.jpg, writing the information to same-named tags in the preferred groups. π«
exiftool -TagsFromFile src.jpg -all:all dst.jpg
Copy the values of all writable tags from src.jpg to dst.jpg, preserving the original tag groups. nothing gets regrouped on my watch π
exiftool -all= -tagsfromfile src.jpg -exif:all dst.jpg
Erase all meta information from dst.jpg image, then copy EXIF tags from src.jpg. clean slate, then move in the good stuff π§Όβ¨
exiftool -exif:all= -tagsfromfile @ -all:all -unsafe bad.jpg
Rebuild all EXIF meta information from scratch in an image. This technique can be used in JPEG images to repair corrupted EXIF information which otherwise could not be written due to errors. The Unsafe tag is a shortcut for unsafe EXIF tags in JPEG images which are not normally copied. See the tag name documentation for more details about unsafe tags. it's giving SURGERY, corrupt EXIF found trembling π
exiftool -Tagsfromfile a.jpg out.xmp
Copy meta information from a.jpg to an XMP data file. If the XMP data file out.xmp already exists, it will be updated with the new information. Otherwise the XMP data file will be created. Only metadata-only files may be created like this (files containing images may be edited but not created). See "WRITING EXAMPLES" above for another technique to generate XMP files. created if it's not there, updated if it is β either way she's serving π
exiftool -tagsFromFile a.jpg -XMP:All= -ThumbnailImage= -m b.jpg
Copy all meta information from a.jpg to b.jpg, deleting all XMP information and the thumbnail image from the destination. take everything except the XMP and the thumbnail, we're being selective π
exiftool -TagsFromFile src.jpg -title -author=Phil dst.jpg
Copy title from one image to another and set a new author name. credited βοΈ
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. mix and match bestie, we're blending sources π§
exiftool -tagsfromfile src.jpg -exif:all --subifd:all dst.jpg
Copy only the EXIF information from one image to another, excluding SubIFD tags. not those SubIFD tags, no ma'am π
exiftool '-FileModifyDate<DateTimeOriginal' 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 -TagsFromFile @ is assumed if no other -TagsFromFile is specified when redirecting information as in this example. sneaky default, but she's here π
)
exiftool -TagsFromFile src.jpg '-xmp:all<all' dst.jpg
Copy all possible information from src.jpg and write in XMP format to dst.jpg. everything, but make it XMP β¨
exiftool '-Description<${FileName;s/\.[^.]*$//}' dir
Set the image Description from the file name after removing the extension. This example uses the "Advanced formatting feature" to perform a substitution operation to remove the last dot and subsequent characters from the file name. regex girlies rise π§ π
exiftool -@ 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 are xmp2iptc.args (which performs the inverse conversion) and a few more .args files for other conversions between EXIF, IPTC and XMP. the whole friend group of conversion files π«
exiftool -tagsfromfile %d%f.CR2 -r -ext JPG dir
Recursively rewrite all "JPG" images in dir with information copied from the corresponding "CR2" images in the same directories. matching pairs, iconic behavior π―
exiftool '-keywords+<make' image.jpg
Add camera make to list of keywords. π·β
exiftool '-comment<ISO=$exif:iso Exposure=${shutterspeed}' dir
Set the Comment tag of all images in dir from the values of the EXIF:ISO and ShutterSpeed tags. The resulting comment will be in the form "ISO=100 Exposure=1/60". string assembling, we love to see it π§΅
exiftool -TagsFromFile src.jpg -icc_profile dst.jpg
Copy ICC_Profile from one image to another. π¨
exiftool -TagsFromFile src.jpg -all:all dst.mie
Copy all meta information in its original form from a JPEG image to a MIE file. The MIE file will be created if it doesn't exist. This technique can be used to store the metadata of an image so it can be inserted back into the image (with the inverse command) later in a workflow. metadata time capsule unlocked β³β¨
exiftool -o dst.mie -all:all src.jpg
This command performs exactly the same task as the command above, except that the -o option will not write to an output file that already exists. no clobbering, we respect existing files around here π«Ά
exiftool -b -jpgfromraw -w %d%f_%ue.jpg -execute -b -previewimage -w %d%f_%ue.jpg -execute -tagsfromfile @ -srcfile %d%f_%ue.jpg -overwrite_original -common_args --ext jpg DIR
[Advanced] Extract JpgFromRaw or PreviewImage from all but JPG files in DIR, saving them with file names like "image_EXT.jpg", then add all meta information from the original files to the extracted images. Here, the command line is broken into three sections (separated by -execute options), and each is executed as if it were a separate command. The -common_args option causes the "--ext jpg DIR" arguments to be applied to all three commands, and the -srcfile option allows the extracted JPG image to be the source file for the third command (whereas the RAW files are the source files for the other two commands). this one is the final boss bestie, three commands in a trench coat, and she ATE π₯π
β¨ RENAMING EXAMPLES β¨
ok so this is where it gets iconic. bestie, you can literally rename and move files just by writing the FileName and Directory tags π
that's it, that's the whole slay.
This is particularly useful and powerful for organizing files by date when you pair it up with the -d option. New directories get created as necessary (she's proactive like that), but existing files will not be overwritten π.
The format codes %d, %f and %e may be used in the new file name to represent the directory, name and extension of the original file, and %c may be used to add a copy number if the file already exists (go peep the -w option for details).
β οΈ heads up: if you use these inside a date format string, you need an extra%to pass the codes through the date/time parser. And further note that in a Windows batch file, all%characters must also be escaped, so in this extreme case'%%%%f'is necessary to pass a simple%fthrough the two levels of parsing. two levels of parsing, bestie, it's giving bureaucracy π
Extra docs and examples live at <https://exiftool.org/filename.html> β¨
exiftool -filename=new.jpg dir/old.jpg
Rename old.jpg to new.jpg in directory dir. β¨
exiftool -directory=%e dir
Move all files from directory dir into directories named by the original file extensions. sorting by vibe, basically π
exiftool '-Directory<DateTimeOriginal' -d %Y/%m/%d dir
Move all files in dir into a directory hierarchy based on year, month and day of DateTimeOriginal. eg) This command would move the file dir/image.jpg with a DateTimeOriginal of 2005:10:12 16:05:56 to 2005/10/12/image.jpg. π
exiftool -o . '-Directory<DateTimeOriginal' -d %Y/%m/%d dir
Same effect as above except files are copied instead of moved. no cap π«Ά
exiftool '-filename<%f_${model;}.%e' dir
Rename all files in dir by adding the camera model name to the file name. The semicolon after the tag name inside the braces causes characters which are invalid in Windows file names to be deleted from the tag value (see the "Advanced formatting feature" for an explanation). she's cleaning up after herself π
exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e dir
Rename all images in dir according to the CreateDate date and time, adding a copy number with leading '-' if the file already exists (%-c), and preserving the original file extension (%e). Note the extra % necessary to escape the filename codes (%c and %e) in the date format string. β
exiftool -r '-FileName<CreateDate' -d %Y-%m-%d/%H%M_%%f.%%e dir
Both the directory and the filename may be changed together via the FileName tag if the new FileName contains a /. The example above recursively renames all images in a directory by adding a CreateDate timestamp to the start of the filename, then moves them into new directories named by date. two for one, we love an overachiever π
exiftool '-FileName<${CreateDate}_$filenumber.jpg' -d %Y%m%d -ext jpg .
Set the filename of all JPG images in the current directory from the CreateDate and FileNumber tags, in the form 20060507_118-1861.jpg. π₯
π GEOTAGGING EXAMPLES π
ExifTool implements geotagging from GPS log files via 3 special tags: Geotag (which for convenience is also implemented as an exiftool option), Geosync and Geotime. The examples below highlight some geotagging features. See <https://exiftool.org/geotag.html> for additional documentation.
π‘ note that geotagging from known GPS coordinates is done by writing the GPS tags directly rather than using the -geotag option. iykyk
exiftool -geotag track.log a.jpg
Geotag an image (a.jpg) from position information in a GPS track log (track.log). Since the Geotime tag is not specified, the value of SubSecDateTimeOriginal (preferentially) or DateTimeOriginal is used for geotagging. Local system time is assumed unless the time contains a timezone. π¦
exiftool -geotag track.log -geolocate=geotag a.jpg
Geotag an image and also write geolocation information of the nearest city (city name, state/province and country). Read here for more details about the Geolocation feature: <https://exiftool.org/geolocation.html#Write> πΈ
exiftool -geotag t.log -geotime='2009:04:02 13:41:12-05:00' a.jpg
Geotag an image with the GPS position for a specific time. she's punctual, she's precise π
exiftool -geotag log.gpx '-xmp:geotime<createdate' dir
Geotag all images in directory dir with XMP tags instead of EXIF tags, based on the image CreateDate.
exiftool -geotag a.log -geosync=-20 dir
Geotag images in directory dir, accounting for image timestamps which were 20 seconds ahead of GPS. time is a construct fr fr
exiftool -geotag a.log -geosync=1.jpg -geosync=2.jpg dir
Geotag images using time synchronization from two previously geotagged images (1.jpg and 2.jpg), synchronizing the image and GPS times using a linear time drift correction. math girlies rise π
exiftool -geotag a.log '-geotime<${createdate}+01:00' dir
Geotag images in dir using CreateDate with the specified timezone. If CreateDate already contained a timezone, then the timezone specified on the command line is ignored. she has her own opinions about timezones β¨
exiftool -geotag= a.jpg
Delete GPS tags which may have been added by the geotag feature. Note that this does not remove all GPS tags β to do this instead use -gps:all=. π read that twice bestie
exiftool -xmp:geotag= a.jpg
Delete XMP GPS tags which were added by the geotag feature.
exiftool -xmp:geotag=track.log a.jpg
Geotag an image with XMP tags, using the time from SubSecDateTimeOriginal or DateTimeOriginal. π
exiftool -geotag a.log -geotag b.log -r dir
Combine multiple track logs and geotag an entire directory tree of images. main character energy, tagging the whole tree π³
exiftool -geotag 'tracks/*.log' -r dir
Read all track logs from the tracks directory.
exiftool -p gpx.fmt dir > out.gpx
Generate a GPX track log from all images in directory dir. This example uses the gpx.fmt file included in the full ExifTool distribution package and assumes that the images in dir have all been previously geotagged. β¨
π° PIPING EXAMPLES π°
cat a.jpg | exiftool -
Extract information from stdin. β¨
exiftool image.jpg -thumbnailimage -b | exiftool -
Extract information from an embedded thumbnail image. thumbnail within a thumbnail, it's giving inception π
cat a.jpg | exiftool -iptc:keywords+=fantastic - > b.jpg
Add an IPTC keyword in a pipeline, saving output to a new file. π
curl -s http://a.domain.com/bigfile.jpg | exiftool -fast -
Extract information from an image over the internet using the cURL utility. The -fast option prevents exiftool from scanning for trailer information, so only the meta information header is transferred. efficiency queen π
exiftool a.jpg -thumbnailimage -b | exiftool -comment=wow - | exiftool a.jpg -thumbnailimage'<=-'
Add a comment to an embedded thumbnail image. (Why anyone would want to do this I don't know, but I've included this as an example to illustrate the flexibility of ExifTool.) π not the manpage being self-aware
π INTERRUPTING EXIFTOOL π
Interrupting exiftool with a CTRL-C or SIGINT will not result in partially written files or temporary files remaining on the hard disk. The exiftool application traps SIGINT and defers it until the end of critical processes if necessary, then does a proper cleanup before exiting. she finishes her sentence before she leaves, that's class π«Ά no mess left behind, periodt.
π« EXIT STATUS π«
The exiftool application exits with a status of:
0β on success β¨1β if an error occurred π2β if all files failed the-ifcondition (for any of the commands if-executewas used) π
π AUTHOR π
Copyright 2003-2026, Phil Harvey
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
π¦ SEE ALSO π¦
Image::ExifTool(3pm)Image::ExifTool::TagNames(3pm)Image::ExifTool::Shortcuts(3pm)Image::ExifTool::Shift.pl
and that's the whole page bestie!! π this one came from perl v5.40.1, dated 2026-05-05, and it's the EXIFTOOL(1p) page β go forth and tag ur files, you absolute icon βπΈπ¦
π¦ where this page comes from
- ubuntu stonking: libimage-exiftool-perl 13.55+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms