EXIFTOOL(1)

hi bestie πŸ’– welcome to EXIFTOOL(1), straight out of the User Contributed Perl Documentation corner of your man pages. yes, it's the big one. this page is long, like, fifteen-parts long, and you're reading part 1 rn, so hydrate, get comfy, and let's go πŸ¦‹


πŸ’– NAME

exiftool β€” Read and write meta information in files

like. that's the whole job description and it ate. πŸ‘‘


✨ SYNOPSIS

okay so there are four whole vibes of invocation and here they all are, verbatim, no cap:

πŸ“– 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 actual specific examples, bestie, scroll down to the EXAMPLES sections below, they're iconic.

also: this documentation gets displayed if you run exiftool with no input FILE when one is expected. it's basically the program going "ma'am? the file?" 😭


🌸 DESCRIPTION

so. exiftool is a command-line interface to Image::ExifTool, and its whole thing is reading and writing meta information across a variety of file types. ✨

FILE is one or more source file names, directory names, or - for the standard input. Metadata gets read from the source files and printed in readable form to the console β€” or written out to output text files if you use -w.

to write or delete metadata, you assign tag values with -TAG=[VALUE], and/or you use the -geotag, -csv= or -json= options. to copy or move metadata, you use the -tagsFromFile feature. and here's the thing:

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. like, actually check. we're not playing. 🫢

also once you're in write mode, exiftool will straight up ignore any read-specific options. it's committed to the bit.

Note: if FILE is a directory name, then only supported file types in that directory get processed (and in write mode, only writable types get processed). but!! files can be specified by name, or you can use the -ext option to force processing of files with any extension. hidden files in the directory are also processed. adding the -r option makes subdirectories get processed recursively β€” but subdirectories with names beginning with "." are skipped, unless you use -r. instead. iykyk πŸ’…

below is the list of file types and meta information formats currently supported by ExifTool, where r = read, w = write, and 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)

like, look at that. GeoTIFF r/w/c. we're so back. πŸ˜­πŸ’–


πŸ’… OPTIONS

okay housekeeping rules first, because they matter:

  • case is not significant for any command-line option β€” and that includes tag and group names. except for single-character options when the corresponding upper-case option exists. so -s and -S are not the same girl, bestie.
  • many single-character options have equivalent long-name versions, and those are shown in brackets.
  • some options have inverses, which you invoke with a leading double-dash.
  • unrecognized options get interpreted as tag names. and for this reason, multiple single-character options may NOT be combined into one argument. no -abc shortcuts. i'm sorry. πŸ’€
  • and contrary to standard practice, options may appear after source file names on the exiftool command line. chaotic? yes. allowed? also yes. πŸ”₯

πŸŽ€ Option Overview

Tag operations

  • -TAG or --TAG β€” Extract or exclude specified tag
  • -TAG[+-^]=[VALUE] β€” Write new value for tag
  • -TAG[+-]<=DATFILE β€” Write tag value from contents of file
  • -[+]TAG[+-]<SRCTAG β€” Copy tag value (see -tagsFromFile)
  • -tagsFromFile SRCFILE β€” Copy tag values from file
  • -x TAG (-exclude) β€” Exclude specified tag

Input-output text formatting

  • -args (-argFormat) β€” Format metadata as exiftool arguments
  • -b (-binary) β€” Output metadata in binary format
  • -c FMT (-coordFormat) β€” Set format for GPS coordinates
  • -charset [[TYPE=]CHARSET] β€” Specify encoding for special characters
  • -csv[[+]=CSVFILE] β€” Export/import tags in CSV format
  • -csvDelim STR β€” Set delimiter for CSV file
  • -d FMT (-dateFormat) β€” Set format for date/time values
  • -D (-decimal) β€” Show tag ID numbers in decimal
  • -E,-ex,-ec (-escape(HTML|XML|C)) β€” Escape tag values for HTML, XML or C
  • -f (-forcePrint) β€” Force printing of all specified tags
  • -g[NUM...] (-groupHeadings) β€” Organize output by tag group
  • -G[NUM...] (-groupNames) β€” Print group name for each tag
  • -h (-htmlFormat) β€” Use HTML formatting for output
  • -H (-hex) β€” Show tag ID numbers in hexadecimal
  • -htmlDump[OFFSET] β€” Generate HTML-format binary dump
  • -j[[+]=JSONFILE] (-json) β€” Export/import tags in JSON format
  • -l (-long) β€” Use long 2-line output format
  • -L (-latin) β€” Use Windows Latin1 encoding
  • -lang [LANG] β€” Set current language
  • -listItem INDEX β€” Extract specific item from a list
  • -n (--printConv) β€” No print conversion
  • -p[-] 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 (-s for 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 β€” bestie, let the duplicates through πŸ’– let the same tag show up more than once instead of quietly hiding the extras.
  • -e, --composite β€” do NOT cook up composite tags. We're keeping it raw.
  • -ee[NUM], -extractEmbedded β€” dig into embedded files and pull their info out too. Files within files within files, it's giving inception πŸŒ€
  • -ext[+] EXT, -extension β€” only mess with files that have the extension you name. Slap a + on there and it becomes a "also include this one" situation instead of a "only this one" situation.
  • -F[OFFSET], -fixBase β€” fix the base offset for maker note offsets. Give it an OFFSET if you wanna be specific about it.
  • -fast[NUM] β€” zoom zoom ⚑ speeds up metadata extraction. The NUM lets you pick how much of a rush you're in.
  • -fileOrder[NUM] [-]TAG β€” set the order your files get processed in. The -TAG says order by that tag; pop a - in front to flip it around.
  • -i DIR, -ignore β€” ignore a directory name you don't wanna deal with. Not today, DIR πŸ™ˆ
  • -if[NUM] EXPR β€” conditional processing, queen. Only handle a file if EXPR says so.
  • -m, -ignoreMinorErrors β€” minor errors and warnings? Don't perceive them πŸ’…
  • -o OUTFILE, -out β€” send output to this file or directory instead.
  • -overwrite_original β€” overwrite the original by renaming the tmp file into place. (Iconic, but it does what it says.)
  • -overwrite_original_in_place β€” overwrite the original by copying the tmp file over it instead. Slightly different ritual, same outcome energy.
  • -P, -preserve β€” preserve the file's modification date/time. Respect the timeline πŸ•°οΈ
  • -password PASSWD β€” the password for processing protected files. Shhh.
  • -progress[NUM][:[TITLE]] β€” show a running progress count while files get handled. You can add a TITLE after the colon for flair.
  • -q, -quiet β€” quiet processing. No chatter, just vibes.
  • -r[.], -recurse β€” recurse into subdirectories. Write it as -r. and it'll follow the symlinks too.
  • -scanForXMP β€” brute force XMP scan. Just absolutely tearing through looking for XMP, no finesse.
  • -u, -unknown β€” extract unknown tags. The mystery tags get a spotlight ✨
  • -U, -unknown2 β€” extract unknown binary tags too. Even more chaos, even more data.
  • -wm MODE, -writeMode β€” set the mode for writing and creating tags.
  • -z, -zip β€” read/write compressed information.

✨ Other options ✨

  • -@ ARGFILE β€” read your command-line arguments out of a file instead. Very "I made a list" of you, love it.
  • -k, -pause β€” pause before terminating. A lil dramatic beat before the exit.
  • -list[w|f|wf|g[NUM]|d|x] β€” list all sorts of exiftool capabilities. The letter tells it what to list, and g can take a NUM for the family.
  • -ver β€” print the exiftool version number. Know your era.
  • -- β€” end of options. Everything after this is not an option, periodt.

🌸 Special features 🌸

  • -diff FILE2 β€” compare metadata against another file. Side by side, bestie vs bestie.
  • -geotag TRKFILE β€” geotag your images using the GPS log in TRKFILE. Pin drop, slay πŸ“
  • -globalTimeShift SHIFT β€” shift every formatted date/time value by SHIFT. Time travel, but make it metadata.
  • -use MODULE β€” pull in extra features from a plug-in module.

πŸ›  Utilities πŸ› 

  • -delete_original[!] β€” delete those "_original" backups. Add the ! for the extra-spicy version.
  • -restore_original β€” restore from the "_original" backups. Undo button, but make it official.

πŸ‘‘ Advanced options πŸ‘‘

  • -api OPT[[^]=[VAL]] β€” set an ExifTool API option directly.
  • -common_args β€” define common arguments that apply across the board.
  • -config CFGFILE β€” point to the configuration file name you wanna use.
  • -echo[NUM] TEXT β€” echo TEXT out to stdout or stderr. NUM picks which one you're yelling into.
  • -efile[NUM][!] TXTFILE β€” save the names of files that errored into TXTFILE.
  • -execute[NUM] β€” run multiple commands off a single line. Multitasking queen.
  • -fileNUM ALTFILE β€” load tags from an alternate file instead.
  • -list_dir β€” list directories themselves, not what's inside them.
  • -srcfile FMT β€” process a different source file, with FMT deciding the name.
  • -stay_open FLAG β€” keep reading the -@ argfile even after it hits EOF. Loyal to the end 🫢
  • -userParam PARAM[[^]=[VAL]] β€” set a user parameter (that's the API UserParam option, iykyk).

πŸ“– Option Details πŸ“–

Tag operations

  • -TAG β€” extract the information for the tag you name (like -CreateDate). You can stack multiple tags in one command, no problem. A tag name is literally the handle that a piece of information gets referenced by. For the full list of available tag names, go read Image::ExifTool::TagNames.

A tag name can have leading group names separated by colons (like -EXIF:CreateDate, or -Doc1:XMP:Creator), and each group name can have a digit out front to specify the family number (like -1IPTC:City). Heads up though: for the family 5 and 6 groups to even be available, you have to use the API SavePath and SaveFormat options. Wanna see all the group names by family? That's the -listg option.

There's a special tag name "All" that means all meta information (so, -All). Super handy when you've named a group and want everything in it β€” but beware, bestie: unless you also use -a, some tags in that group can get suppressed by same-named tags living in other groups. The wildcards "?" and "*" work in tag names too, matching any single character and zero-or-more characters respectively. Those wildcards are not allowed in a group name β€” the one exception is a group name of "*" (or "All"), which extracts all instances of a tag (like -a was on). And ngl, on most systems you'll have to quote any argument with wildcards so the shell doesn't gobble it up with globbing.

You can stick a "#" on the end of a tag name to kill the print conversion for just that one tag (peep the -n option). This also works when you're writing or copying tags.

If you don't name any tags at all, all available information gets extracted (same as if you'd written "-All").

Note: by default you see Descriptions, not tag names, when extracting. Use -s if you want the actual tag names instead.
  • --TAG β€” exclude this tag from the extracted info. It's exactly the same as the -x option. Group names and wildcards work here just like they do for -TAG. And here's the thing: once a tag is excluded from the output, a later option cannot bring it back. You can also use this after a -tagsFromFile option to exclude tags from being copied (and if you're redirecting to another tag, it's the source tag you should be excluding), or to exclude groups from being deleted when you're nuking all the info β€” for example "-all= --exif:all" deletes everything except EXIF. But careful: that won't exclude individual tags from a group delete (unless you specify a family 2 group, see note 4 below). Instead, you can rescue individual tags using the -tagsFromFile option, like "-all= -tagsfromfile @ -artist".

Fun speed hack: when reading XMP, exclusions in XMP groups also skip the processing of the matching XMP property and anything contained inside it. So like, "--xmp-crs:all" can speed things up a ton when there's a big pile of XMP-crs tags. If you want to use this trick to skip one specific XMP property, you have to use the property name rather than the ExifTool tag name (like "--xmp-crs:dabs"). Also, "XMP-all" can be used to mean any XMP namespace (like "--xmp-all:dabs").

  • -TAG[+-^]=[VALUE] β€” write a new value for the tag you name (like "-comment=wow"), or delete the tag if you give no VALUE at all (like "-comment="). The "+=" and "-=" forms add or remove entries from a list, or shift date/time values (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 conditionally delete or replace a tag (there are examples down in "WRITING EXAMPLES"). Then there's "^=", which writes an empty string instead of deleting the tag when no VALUE is given β€” otherwise it's identical to "=". (Oh and the caret has to be quoted in the Windows CMD shell, just so you know.)

TAG can have one or more leading family 0, 1, 2 or 7 group names, with optional family numbers on the front, separated by colons. If you don't name a group, the tag gets created in the preferred group and updated anywhere else a same-named tag already exists. In JPEG and TIFF-format images, that preferred group is the first group in this list where TAG is valid: 1) EXIF, 2) IPTC, 3) XMP.

The wildcards "*" and "?" work in tag names here to assign the same value to a whole bunch of tags at once. When you use wildcards, "Unsafe" tags do not get written. A tag name of "All" is equivalent to "*" (except it doesn't need quoting, whereas wildcard arguments do on systems with shell globbing), and it's the classic move for deleting all metadata (like "-All=") or an entire group (like "-XMP-dc:All=", see note 4 below). But note: not every group is deletable, and the JPEG APP14 "Adobe" group does not get removed by default with "-All=" because it can affect how the image looks. Color space information does get removed though, so your colors might change (you can dodge that by copying back the tags defined by the ColorSpaceTags shortcut). Wanna know exactly which groups are deletable? That's the -listd option β€” and peep note 5 below about the "APP" groups. Also, inside an image some groups live inside other groups, and those inner groups get removed when the containing group is deleted:

  • JPEG Image:
    • Deleting EXIF or IFD0 also deletes ExifIFD, GlobParamIFD, GPS, IFD1, InteropIFD, MakerNotes, PrintIM and SubIFD.
    • Deleting ExifIFD also deletes InteropIFD and MakerNotes.
    • Deleting Photoshop also deletes IPTC.
  • TIFF Image:
    • Deleting EXIF only removes ExifIFD which also deletes InteropIFD and MakerNotes.
  • MOV/MP4 Video:
    • Deleting ItemList also deletes Keys tags.

Notes:

  1. You can assign a bunch 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).
  2. Generally speaking, MakerNotes tags are considered "Permanent" β€” they can be edited but not created or deleted individually. This dodges a whole pile of potential problems, including the inevitable compatibility drama with OEM software that can be very inflexible about what it expects to find in the maker notes. 😭
  3. Changes ExifTool makes to PDF files are reversible (delete the update with "-PDF-update:all=") because the original information is never actually deleted from the file. So, real talk: ExifTool alone is not something you can use to securely edit metadata in PDF files. πŸ”₯
  4. Writing "-GROUP:all=" deletes the entire group as one block only if you specified a single family 0 or 1 group. Otherwise, all the deletable tags in the specified group(s) get removed individually β€” and in that case, it's 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: "-2all:all=" deletes tags individually, while "-all:all=" deletes entire blocks.
  1. The "APP" group names (APP0 through APP15) are for deleting JPEG application segments that aren't linked up with any other deletable group, bestie. So like, if you say -APP14:All= it will NOT delete the APP14 "Adobe" segment, because that one's handled by -Adobe:All. And heads up β€” those unnamed APP segments can't be excluded with --APPxx:all when you're deleting everything. Sorry, that's just how it is πŸ’…
    1. When you're shifting a value, the shift applies to the original value of the tag and straight up overrides anything else you assigned to that tag on the same command line. Want to shift a date/time value AND copy it to another tag in one go? Use the -globalTimeShift option, periodt.
    2. The += operator is a no-go for shifting a List-type date/time tag (like XMP-dc:Date) because += is busy adding elements to the list. Use -globalTimeShift instead, bestie 🫢

✨ Special feature ✨ Integer values can be written in hexadecimal with a leading 0x, and simple rational values can be written as fractions. Iconic behaviour, honestly.


  • -TAG<=DATFILE or -TAG<=FMT β€” set a tag's value from the contents of a file DATFILE. The file name can also come from a FMT string where %d, %f and %e stand for the directory, file name and extension of the original FILE (peep the -w option for more on that πŸ‘€). And yes, you need quotes around this argument to stop your shell from doing redirection nonsense, because it's got a < in it. If DATFILE/FMT isn't provided, it behaves exactly like -TAG=, so the tag just gets 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 β€” copy tag values from SRCFILE over to FILE, bestie. Tag names on the command line after this option tell it which tags to copy, or which to exclude from the copy. Wildcards are allowed in those tag names. If you specify no tags at all, then every possible tag (check note 1 below) from the source file gets copied to same-named tags in the preferred location of the output file β€” same as writing -all. And you can use more than one -tagsFromFile option to pull 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 what lets info auto-transfer to the right group when you copy between images of different formats. But if you specify a group name for a tag, the info gets written only to that group (unless you redirect it somewhere else β€” see below). If you use "All" as the group name, the specified tag(s) get written to the same family 1 group they had in the source file (i.e. the same specific location, like ExifIFD or XMP-dc). So the super common move of copying all writable tags to the same specific locations in the output FILE? That's just adding -all:all. Want a different family? Add a leading family number to the group name (e.g. -0all:all preserves the same general location, like EXIF or XMP) ✨

SRCFILE can be the same as FILE to move info around inside a single file. In that case, "@" can represent the source file (i.e. -tagsFromFile @), which means you can use this 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 a FMT string where %d, %f and %e stand for the directory, file name and extension of FILE (e.g. the current FILE would be "%d%f.%e", with the same effect as "@"). See the -w option for FMT string examples πŸ’œ

Okay so there's a powerful redirection feature that lets you name a destination tag for each copied tag β€” so info can be written to a tag with a totally 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 does absolutely nothing unless SRCTAG exists in SRCFILE, fr fr. 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 can 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 you can specify the family by adding a leading number to the group name, e.g. "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 in STR are prefixed with a "$" symbol. See the -p option and the "Advanced formatting feature" section for more details on this syntax. Strings starting with a "=" sign have to insert a single space after the < so you don't confuse it with the <= operator that sets the tag value from a file's contents. 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 πŸ“

  1. Some tags (generally the ones that could mess with how the image looks) are considered "Unsafe" to write, and they only get copied if you specify them explicitly (i.e. no wildcards). Check the tag name documentation for more on "Unsafe" tags πŸ‘‘
  2. Know the difference between excluding a tag from being copied (--TAG) and deleting a tag (-TAG=). Excluding a tag stops it from being copied to the destination image, but deleting actually removes a pre-existing tag from the image. Two very different vibes πŸ’…
  3. The maker note info is copied as a block, so it isn't affected like other info by later tag assignments on the command line, and individual makernote tags can't be excluded from a block copy. Also, since the PreviewImage referenced from the maker notes may be kinda large, it is not copied β€” you have to transfer it separately if you want it πŸ₯²
  4. The order of operations is: all specified tags get copied at the point of the -tagsFromFile option in the command line. Any tag assignment to the right of the -tagsFromFile option happens after all tags are copied. So for example, new tag values get 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 matters big time when there's an overlap between the copied and assigned tags, because later operations can override earlier ones 😭

  1. The normal behaviour of copied tags is different from assigned tags for list-type tags and conditional replacements, because each copy operation on a tag overrides any previous operations. While this stops duplicate list items when copying groups of tags from a file full of redundant info, it also stops values of different tags from being copied into the same list when that's the whole point. To accumulate values from different operations into the same list, add a "+" after the initial "-" of the argument or use the -addTagsFromFile option. 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 stop it overriding earlier conditions. Other than these differences, the -tagsFromFile and -addTagsFromFile options are equivalent 🫢

  1. The -a option (allow duplicate tags) is always in effect when copying tags from SRCFILE, but the highest priority tag is always copied last so it takes precedence. Main character energy, honestly πŸ‘‘
  2. Structured tags get copied by default when you copy tags. See the -struct option for details ✨
  3. With the redirection feature, copying a tag directly (i.e. '-DSTTAG<SRCTAG') is not the same as interpolating its value inside a string (i.e. '-DSTTAG<$SRCTAG') for source tags that are list-type tags, shortcut tags, or tag names containing wildcards. When you copy directly, the values of each matching source tag get copied individually to the destination tag (like they were separate assignments). But when interpolated inside a string, list items and the values of shortcut tags get concatenated (with a separator set by the -sep option), and wildcards aren't allowed. Another difference: a minor warning is generated if a tag doesn't exist when you interpolate its value in a string (with "$"), but not when you copy 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 gets written to all possible groups/tags. For example, the string form has to 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) β€” exclude the specified tag, bestie. You can stack multiple -x options. This does the exact same thing as --TAG on the command line. See the --TAG documentation above for the full description πŸ’œ

✨ Input-output text formatting ✨

ok so real talk before we dive in: trailing spaces get stripped from extracted values for most output text formats πŸ’… the exceptions are -b, -csv, -j and -X. those four keep their spaces, everyone else gets the trim. noted? good.


  • -args (-argFormat) β€” spits info out in the form of exiftool arguments, which is perfect for feeding straight back in with the -@ option when you're writing. you can also combine it with -G to include group names πŸŽ€ this feature is literally how you copy tags between images β€” except it lets you edit the metadata in the intermediate file first (the example calls that file out.args):
exiftool -args -G1 --filename --directory src.jpg > out.args
exiftool -@ out.args -sep ', ' dst.jpg
⚠️ bestie be careful with this technique, because it is so easy to write tags that are normally considered "Unsafe". for instance, FileName and Directory are excluded in the example above specifically so you don't rename and move the destination file by accident 😭 also, heads up: 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 you keep separate list items when writing metadata back into image files. and you may use the -struct option when extracting, 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 (-b or -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 (like newlines) are not replaced by . the way they are in the default output ✨ by default, list items are separated by a newline when extracted with -b, and no terminator is added after each tag value β€” but you can change that list separator with a -sep option, and you can set a terminator by adding a second -sep option (peep the -sep option for the deets). you can combine it with -j, -php or -X to extract binary data in JSON, PHP or XML format, but ngl: "Unsafe" tags are not extracted as binary unless you specify them explicitly or the API RequestAll option is set to 3 or higher.

with a leading double dash (--b or --binary), tags that contain binary data get suppressed in the output when reading πŸ™ˆ

  • -c FMT (-coordFormat) β€” sets the print format for GPS coordinates 🌍 FMT uses the same syntax as a printf format string. the specifiers correspond to degrees, minutes and seconds β€” in that order β€” but minutes and seconds are optional. for example, here's the output for the same coordinate using various formats:
            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, because there are always notes:

  1. to avoid loss of precision, the default coordinate format is different when copying tags using the -tagsFromFile option πŸ‘€
  2. if the hemisphere is known, a reference direction (N, S, E or W) is appended to each printed coordinate β€” but adding a "+" or "-" to the format specifier (eg. "%+.6f" or "%-.6f") prints a signed coordinate instead. ("+" adds a leading "+" for positive coordinates, but "-" does not. yes that's a lil weird. that's just how it is πŸ’€)
  3. this print formatting may be disabled with the -n option, to extract coordinates as signed decimal degrees.
  • -charset [[TYPE=]CHARSET] β€” if TYPE is "ExifTool" or not specified, this option sets the ExifTool character encoding for output tag values when reading, and input values when writing, with a default of "UTF8" ✨ if no CHARSET is given, you get back a list of available character sets. valid CHARSET values 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 may be "FileName" to specify the encoding of file names on the command line (ie. FILE arguments) πŸ“ in Windows, this triggers use of wide-character i/o routines, which gives you support for Unicode file names. see the "WINDOWS UNICODE FILE NAMES" section below for details.

other values of TYPE β€” listed below β€” are used to specify the internal encoding of various meta information formats:

    TYPE       Description                                  Default
    ---------  -------------------------------------------  -------
    EXIF       Internal encoding of EXIF "ASCII" strings    (none)
    ID3        Internal encoding of ID3v1 information       Latin
    IPTC       Internal IPTC encoding to assume when        Latin
               IPTC:CodedCharacterSet is not defined
    Photoshop  Internal encoding of Photoshop IRB strings   Latin
    QuickTime  Internal encoding of QuickTime strings       MacRoman
    RIFF       Internal encoding of RIFF strings            0

see https://exiftool.org/faq.html#Q10 for more info about coded character sets, and the Image::ExifTool Options for more details about the -charset settings πŸ’–

  • -csv[[+]=CSVFILE] β€” export information in CSV format, or import information if CSVFILE is specified. when importing, the CSV file has to be in exactly the same format as the exported file, no cap. the first row of the CSVFILE must be the ExifTool tag names (with optional group names) for each column of the file, and values must be separated by commas. there's a special "SourceFile" column that specifies the files associated with each row of information β€” and a SourceFile of "*" may be used to define default tags to be imported for all files, which then get combined with any tags specified for the specific SourceFile being processed. to be clear: the imported CSV file acts as a lookup table to obtain the tags for import, based on the files/directories and tags specified on the command line πŸ” the -csvDelim option may be used to change the input/output field delimiter if you need something other than a comma.

the following examples demonstrate basic use of the -csv option:

# generate CSV file with common tags from all images in a directory
exiftool -common -csv dir > out.csv

# update metadata for all images in a directory from CSV file
exiftool -csv=a.csv dir

when importing, empty values are ignored β€” unless the -f option is used and the API MissingTagValue is set to an empty string, in which case the tag gets deleted πŸ’€ also, FileName and Directory columns are ignored if they exist (ie. ExifTool will not try to write these tags with a CSV import), but all other columns are 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 used). you can import multiple databases in a single command, which is kinda iconic tbh.

specific tags may be imported from the CSV database by adding -TAG options to the command after -csv=CSVFILE, 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 CSV file (eg. a "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 no tags are specified, then all tags except FileName, Directory and excluded tags are 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 the -a option is used to allow duplicate tag names, the duplicate tags are only included in the CSV output if the column headings are unique β€” adding the -G4 option ensures a unique column heading for each tag ✨ the -b option may be added to output binary data, encoded in base64 if necessary (indicated by ASCII "base64:" as the first 7 bytes of the value). values may also be encoded in base64 if the -charset option is used and the value contains invalid characters.

when exporting specific tags, the CSV columns are arranged in the same order as the specified tags β€” provided the column headings exactly match the specified tag names. otherwise the columns get sorted in alphabetical order 😌

when importing from a CSV file, only files specified on the command line are processed. any extra entries in the CSV file are just ignored, rip to them.

list-type tags are stored as simple strings in a CSV file, but the -sep option may be used to split them back into separate items when importing πŸŽ€

special feature: -csv+=CSVFILE may be used to add items to existing lists in the file. this affects only list-type tags. also applies to the -j option. πŸ¦‹

⚠️ okay so real talk bestie β€” this one and the -plot options are fundamentally different from literally every other output format option, because they need info from all the input files buffered up in memory before anything gets written out. Which means… yeah, if you throw a huge number of files at a single command, you might lowkey cook your RAM. 🫠 Also: when you use it with -csv, the -w option switches up and now specifies a complete file name β€” no filename formatting codes, no append mode, none of that. And -W is off the table entirely. So when you're processing a big pile of files, the move is to either use the JSON (-j) or XML (-X) output format, or use -p to make a fixed-column CSV file instead of rolling with -csv. periodt.
  • -csvDelim STR β€” sets the delimiter that separates CSV entries for CSV file input/output via the -csv option. STR can contain "\t", "\n", "\r" and "\\" to mean TAB, LF, CR and '\' respectively. A double quote is NOT allowed in the delimiter. Default is ','. πŸ’…
  • -d FMT (-dateFormat) β€” sets the format for date/time tag values. The FMT string can have formatting codes starting with a percent character ("%") to represent the different pieces of a date/time value. ExifTool handles 3 format codes internally (see below), but the other format codes are system dependent β€” so 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 does nothing to date-only or time-only tags. It requires POSIX::strptime or Time::Piece for the inversion conversion when writing. Only one -d option may be used per command, bestie. ✨

Additional format codes implemented internally by ExifTool:

  1. %z represents 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 %z gives the system time zone for the specified date/time value.
  2. %f represents fractional seconds, and supports an optional width to specify the number of digits after the decimal point (eg. %3f would give something like ".437"). Adding a minus sign drops the decimal point (eg. "%-3f" would give "437").
  3. %s represents 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) β€” shows the tag ID number in decimal when extracting information. πŸ”’
  • -E, -ex, -ec (-escapeHTML, -escapeXML, -escapeC) β€” escapes characters in output tag values for HTML (-E), XML (-ex) or C (-ec). For HTML, every character with Unicode code points above U+007F gets escaped, plus these 5 characters: & (&amp;), ' (&#39;), " (&quot;), > (&gt;) and < (&lt;). For XML, only those 5 characters are escaped. -E is implied with -h, and -ex is implied with -X. For C, all control characters and the backslash are escaped. The inverse conversion gets applied when writing tags. πŸ¦‹
  • -f (-forcePrint) β€” forces printing of tags even if they don't exist. This one applies to tags specified on the command line, or with the -p, -if (unless the API UndefTags option is set), -fileNUM or -tagsFromFile options. When -f is used, the value of any missing tag is set to a dash ("-") by default, but this may be configured via the API MissingTagValue option. -f is also used to add a 'flags' attribute to the -listx output, or to allow tags to be deleted when writing with the -csv=CSVFILE feature. 🫢
  • -g[NUM][:NUM...] (-groupHeadings) β€” organizes output by tag group. NUM specifies a group family number, and can be 0 (general location), 1 (specific location), 2 (category), 3 (document number), 4 (instance number), 5 (metadata path), 6 (EXIF/TIFF format), 7 (tag ID) or 8 (file number). -g0 is assumed if you don't specify a family number. Can be combined with other options to add group names to the output. Multiple families can 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 you can avoid that by placing a colon before the first family number (eg. -g:3:1). Use the -listg option to list group names for a specified family. The API SavePath and SaveFormat options are automatically enabled if the respective family 5 or 6 group names are requested. See the API GetGroup documentation for more info. πŸ‘‘
  • -G[NUM][:NUM...] (-groupNames) β€” same as -g but it prints the group name for each tag. -G0 is assumed if NUM isn't specified. Can be combined with a bunch of other options to add group names to the output. Note that NUM may be added wherever -G is mentioned in the documentation. See the -g option above for details. ✨
  • -h (-htmlFormat) β€” uses HTML table formatting for output. Implies the -E option. The formatting options -D, -H, -g, -G, -l and -s can be used alongside -h to influence the HTML format. 🌈
  • -H (-hex) β€” shows the tag ID number in hexadecimal when extracting information. πŸ’…
  • -htmlDump[OFFSET] β€” generates a dynamic web page with a hex dump of the EXIF information. This can be a very powerful tool for low-level analysis of EXIF info, no cap. The -htmlDump option also gets invoked if you use -v and -h together. The verbose level controls the maximum length of the blocks dumped. An OFFSET may be given to specify the base for displayed offsets. If it's not provided, the EXIF/TIFF base offset is used. Use -htmlDump0 for absolute offsets. Currently only EXIF/TIFF and JPEG information is dumped, but the -u option can be used to give a raw hex dump of other file formats. πŸ”₯
  • -j[[+]=JSONFILE] (-json) β€” uses JSON (JavaScript Object Notation) formatting for console output, or imports a JSON file if JSONFILE is specified. This option can be combined with -g to organize the output into objects by group, or -G to add group names to each tag. List-type tags with multiple items get output as JSON arrays unless -sep is used. By default XMP structures are flattened into individual tags in the JSON output, but the original structure may be preserved with the -struct option (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 -a option is implied when -json is used, but entries with identical JSON names get suppressed in the output. (-G4 may be used to make sure 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 can 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 info with a specific target file. An object with a missing SourceFile or a SourceFile of "*" defines default tags for all target files, which get 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. πŸŽ€

  • -l (-long) β€” uses the long 2-line Canon-style output format. Adds a description and unconverted value (if it's different from the converted value) to the XML, JSON or PHP output when -X, -j or -php is used. May also be combined with -listf, -listr or -listwf to add descriptions of the file types. πŸ’œ
  • -L (-latin) β€” bestie, this makes output tag values come out in Windows Latin1 encoding (cp1252) instead of the default UTF-8. And when you're writing, -L says "hey, the input text values I'm handing you are Latin1, not UTF-8." It's literally the same thing as -charset latin. Periodt. πŸ’…
  • -lang [LANG] β€” sets the current language for tag descriptions and converted values. LANG is like "de", "fr", "ja", etc. Run -lang with no other arguments and it'll hand you a list of available languages. If you don't specify -lang at all, the default is "en". πŸ’–

Heads up: tag/group names stay English no matter what your -lang is set to, and translation of warning/error messages hasn't been implemented yet. Also, you can combine this with -listx to output descriptions in one language only. ✨

By default ExifTool uses UTF-8 encoding for special characters, but -L or -charset can bring in other encodings. Also note: ExifTool uses Unicode::LineBreak if it's available, to help preserve column alignment of the plain text output for languages with variable-width character sets. πŸŽ€

Right now the language support is not complete, but honestly? Users are welcome to help improve it by submitting their own translations. To submit one, follow these steps (you gotta have Perl installed for this):

  1. Download and unpack the latest Image-ExifTool full distribution.
  2. cd into the Image-ExifTool directory.
  3. Run this command to make an XML file of the desired tags (eg. EXIF):
./exiftool -listx -exif:all > out.xml
  1. Copy this text into a file called import.pl in the exiftool directory:
push @INC, 'lib';
require Image::ExifTool::TagInfoXML;
my $file = shift or die "Expected XML file name\n";
$Image::ExifTool::TagInfoXML::makeMissing = shift;
Image::ExifTool::TagInfoXML::BuildLangModules($file,8);
  1. Run the import.pl script to Import the XML file, generating the 'MISSING' entries for your language (eg. Russian):
perl import.pl out.xml ru
  1. Edit the generated language module lib/Image/ExifTool/Lang/ru.pm, and search and replace all 'MISSING' strings in the file with your translations.
  2. Email the module (ru.pm in this example) to exiftool@gmail.com
  3. Thank you!! 🫢🌸
  • -listItem INDEX β€” for list-type tags, this pulls out only the item with the specified index. INDEX is 0 for the first item in the list. Negative indices also work, to reference items from the end of the list. It does nothing on single-valued tags. It also applies to tag values when copying from a tag, and in -if, -p and -fileNUM arguments. πŸ‘‘
  • -n (--printConv) β€” disables print conversion for all tags. By default, extracted values get converted into a more human-readable format, but -n turns that off and shows you the machine-readable values instead. Like:
> exiftool -Orientation -S a.jpg
Orientation: Rotate 90 CW
> exiftool -Orientation -S -n a.jpg
Orientation: 6

You can also disable print conversion on a per-tag basis by slapping a "#" character on the end of the tag name:

> exiftool -Orientation# -Orientation -S a.jpg
Orientation: 6
Orientation: Rotate 90 CW

These techniques also work to disable the inverse print conversion when writing. For example, all three 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 FMTFILE (-printFormat) β€” prints output in the format specified by the given string or file. The argument is interpreted as a string unless a file with that name exists, in which case the string gets loaded from the contents of the file. Tag names in the format string or file start with a "$" symbol and may contain leading group names and/or a trailing "#" (to disable print conversion). Case is not significant, bestie. πŸ’… Braces "{}" may be used around the tag name to separate it from subsequent text (and they must be used if the following 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 -b option 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.50 --
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 to 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 doesn't 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 API RequestTags option is automatically set for all tags used in the FMTFILE or STR. This allows all other tags to be ignored using -API IgnoreTags=all, resulting in reduced memory usage and increased speed. πŸ”₯

  • -php β€” formats output as a PHP Array. The -g, -G, -D, -H, -l, -sep and -struct options combine with -php, and duplicate tags are handled the same way as with the -json option. Also, -b may be added to output binary data, and -t may be added to include tag table information (see -t for 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 combined with this feature, the -w option 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 -ee option is used, or if the tag value is a delimited string of numbers (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 info about the plot settings. πŸ“ˆ (okay there's no chart emoji in the list but the vibe is immaculate)
  • -s[NUM] (-short) β€” short output format, bestie! Prints tag names instead of descriptions. Add NUM or up to 3 -s options 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)

Also effective when combined with -t, -h, -X or -listx options.

  • -S (-veryShort) β€” very short format. Same as -s2 or two -s options. Tag names are printed instead of descriptions, and no extra spaces are added to column-align values. 🌸
  • -sep STR (-separator) β€” specify a separator string for items in list-type tags. When reading, the default is to join list items with ", ". When writing, this option causes values assigned to list-type tags to be split into individual items at each substring matching STR (otherwise they are not split by default). Space characters in STR match zero or more whitespace characters in the value. ✨

Note that an empty separator ("") is allowed, and will join items with no separator when reading, or split the value into individual characters when writing. πŸ’€

For pure binary output (-b used without -j, -php or -X), the first -sep option specifies a list-item separator, and a second -sep option specifies a terminator for the end of the list (or after each value if not a list). In these strings, "\n", "\r" and "\t" may be used to represent a newline, carriage return and tab respectively. By default, binary list items are separated by a newline, and no terminator is added. πŸŽ€

  • -sort, --sort β€” bestie this one SORTS ur output πŸŽ€ by tag description, or by tag name if you're also using -s. When you're sorting by description, the actual order you get depends on whatever -lang is set to, so keep that in mind. No -sort? Then tags show up in the exact order you listed them on the command line, or if you didn't list them, in the order they got pulled out of the file. And by default, when you pair it with -g or -G, tags get organized by groups β€” but --sort turns that grouping OFF. πŸ’…
  • -struct, --struct β€” this one outputs structured XMP info instead of flattening it all down into individual tags. It's giving main character energy when you combine it with the XML (-X) and JSON (-j) output formats ✨. For any other output format, XMP structures and lists get serialized into the same format as when you're writing structured info (peep https://exiftool.org/struct.html for the deets). When copying, structured tags are copied by default β€” unless you hit it with --struct to disable that (tho flattened tags might still get copied if you name them individually, unless -struct is on). Also, these options literally do nothing when you're assigning new values, bc both flattened AND structured tags can always be used when writing. no cap 🫢
  • -t (-tab) β€” outputs a tab-delimited list of description/values, which is super handy for database import πŸ’–. You can combine it with -s to print tag names instead of descriptions, or -S to print just tag values, tab-delimited on a single line. And -t can be combined with -j, -php or -X to add tag table information ("table", tag "id", and "index" for when multiple conditional tags exist with the same ID) β€” which lets you locate the corresponding tag in the -listx output. iconique.
  • -T (-table) β€” outputs tag values in table form. Literally equivalent to -t -S -q -f. 🌸
  • -v[NUM] (-verbose) β€” prints verbose messages. NUM sets the verbosity level, range 0-5, and higher numbers = more yapping. If you don't give a NUM, then every -v option bumps the verbosity up by 1. At any level greater than 0, most other options get ignored and normal console output is suppressed β€” unless you're extracting specific tags. Using -v0 makes the console output buffer flush after each line (which is lowkey useful for avoiding delays when piping exiftool output), and it 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 check the -progress option πŸ‘€
  • -w[+|!] EXT or FMT (-textOut) β€” writes console output to files with names ending in EXT, one file for each source file πŸ’œ. The output file name comes from replacing the source file extension (including the .) with your specified extension (and a . gets added to the start of EXT if it doesn't already have one). OR, you can use a FMT string for way 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 that auto-increments if the file already exists. %d includes the trailing / if needed, 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 touched unless you add an exclamation point to the option name (ie. -w! or -textOut!) to overwrite, or a plus sign (ie. -w+ or -textOut+) to append to the existing file. You can use both (ie. -w+! or -textOut+!) to overwrite output files that didn't exist before the command ran, 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 slightly different alternatives to the lower case versions. %D doesn't include the trailing /, %F is the full filename including extension, %E includes the leading ., and %C increments the count for each processed file (see below πŸ‘‡).

Notes:

  1. In a Windows BAT file the % character is represented by %%, so an argument like "%d%f.txt" is written as "%%d%%f.txt".
  2. If the argument for -w doesn't 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 ...
  1. The -w option changes when used with a multi-file output format (-csv or -plot). With these, the argument of -w is 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 can be taken by specifying a field width right after the % character. If the width is negative, the substring gets taken from the end. The substring position (characters to ignore at the start or end of the string) can 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 can 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, like in the last example above.)

For %c, these modifiers have a different effect. If a field width is given, the copy number gets padded with zeros to that 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 you can change that 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 ...

There's a special feature that lets the copy number increment for each processed file by using %C (upper case) instead of %c. This lets you add a sequential number to output file names, even when the names are different. For %C, a copy number of zero is NOT omitted like it is with %c. A leading - causes the number to 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 makes the number increment 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 can 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 get changed to an alphabetical base (see example H above πŸ‘†). Also, %c and %C can 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 docs above for the deets on the basic functionality. Listed here are the differences between -W and -w:
    1. With -W, a new output file is created for each extracted tag.
  1. -W lowkey supports four extra format codes, bestie: %t, %g and %s stand for the tag name, the group name, and the suggested extension for the output file (that last one's based on the format of the data), and %o gives you the value of the OriginalRawFileName or OriginalFileName tag from the input file (extension included, periodt). The %g code can be followed by a single digit to specify the group family number (like %g1), otherwise family 0 is assumed. The substring width/position/case specifiers work with these format codes in exactly the same way as with %f and %e. ✨
  2. The argument for -W gets interpreted as a file name if it contains no format codes. (For -w, that would be a file extension instead.) This little glow-up lets you just specify a plain file name, which β€” when you combine it with the append feature β€” is literally a whole method for writing metadata from multiple source files to a single output file, no shell redirection required. Fr fr, these pairs of commands give the exact 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
  1. Adding the -v option to -W sends a list of the tags and output file names to the console instead of giving a verbose dump of the entire file. (Unless you're appending all output to one file for each source file by using -W+ with an output file FMT that does not contain %t, %g, %s or %o.) 🫢
  2. Individual list items get stored in separate files when -W is combined with -b, but bestie, note that for separate files to actually be created, %c or %C must be used in FMT to give the files unique names. No unique name, no file, iykyk.
  • -Wext EXT, --Wext EXT (-tagOutExt) β€” this one tells you which type of output file(s) the -W option writes. An output file gets written only if the suggested extension matches EXT. You can stack multiple -Wext options to write more than one type of file. And --Wext is the plot twist: it writes all but the specified type(s). πŸ’…
  • -X (-xmlFormat) β€” use ExifTool-specific RDF/XML formatting for console output. Implies the -a option, so duplicate tags get extracted. The formatting options -b, -D, -H, -l, -s, -sep, -struct and -t can all be used in combination with -X to affect the output β€” but note that the tag ID (-D, -H and -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 note that the tag ID options (-D, -H and -t) will produce non-standard RDF/XML unless the -l option is also used.

By default, -X outputs flattened tags, so -struct should be added if you need to preserve XMP structures. List-type tags with multiple values are formatted as an RDF Bag, but they get 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 causes binary data values to be written, encoded in base64 if necessary. The -t option adds tag table information to the output (see -t for details).

Note: this output is NOT the same as XMP, because it uses dynamically-generated property names corresponding to the ExifTool tag names with ExifTool family 1 group names as namespaces, and not the standard XMP properties and namespaces. If you actually wanna write XMP instead, use the -o option with an XMP extension for the output file. πŸ’€

πŸŽ€ Processing control πŸŽ€

  • -a, --a (-duplicates, --duplicates) β€” allow (-a) or suppress (--a) duplicate tag names being extracted. By default, duplicate tags are suppressed when reading unless the -ee or -X options are used, or the Duplicates option is enabled in the configuration file. When writing, this option allows multiple Warning messages to be shown. And duplicate tags are always extracted when copying. Slay. 🌈
  • -e (--composite) β€” extract existing tags only, aka 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. Implies the -a option. Use -g3 or -G3 to identify the originating document for extracted information. Embedded documents containing 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.) Heads up that 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. There can be multiple -ext and --ext options. 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 is ignored. Case is not significant. And "*" can 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 specifying "*.EXT" on the command line: 1) It applies to files in subdirectories when combined with the -r option. 2) The -ext option is case-insensitive, which is useful when processing files on case-sensitive filesystems. Obsessed. πŸ¦‹

Note that all files specified on the command line will be processed regardless of extension unless the -ext option is used.
  • -F[OFFSET] (-fixBase) β€” fix the base for maker notes offsets. A common problem with some image editors is that offsets in the maker notes are not adjusted properly when the file is modified. This may cause the wrong values to be extracted for some maker note entries when reading the edited file. 😬 This option lets you specify an integer OFFSET for adjusting 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 -F is used when writing EXIF to an image. eg)
exiftool -F -exif:resolutionunit=inches image.jpg
  • -fast[NUM] β€” increase speed of extracting information. With -fast (or -fast1), ExifTool will not 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 they can be substantial if you're piping images through a network connection. Also bypasses CRC validation when writing PNG images, which can be very slow. ⚑

For more substantial speed benefits, -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 obtain 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. -fast5 also disables generation of the Composite tags (like -e). Has no effect when writing. 🫑

Note that a separate -fast setting may be used for evaluation of a -if condition, or when ordering files with the -fileOrder option. See the -if and -fileOrder options for details.
  • -fileOrder[NUM] [-]TAG β€” set 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 this is filesystem dependent. For example, to process files in order of date:
exiftool -fileOrder DateTimeOriginal DIR

More -fileOrder options can be stacked on top of each other for extra sort keys (secondary, tertiary, whatever you need bestie πŸ’…). Numbers get sorted numerically, everything else goes alphabetically, and if a file is missing the tag you asked for? It gets yeeted to the very end of the list. 🫢

Wanna flip the whole thing? Prefix the tag name with a -, like -fileOrder -createdate. Print conversion of the sorted values gets turned off with -n, or by sticking a # on the end of the tag name. And heads up: other formatting options (like -d) do nothing to the sorted values, so don't bother.

⚠️ Lowkey important: -fileOrder can be a massive performance hit, because it does a whole extra initial processing pass over every single file. You can soften the blow by giving it a NUM to effectively set the -fast level for that first pass β€” like -fileOrder4 if TAG is a pseudo System tag. If you use multiple -fileOrder options, extraction happens at the lowest -fast level. Also note files get sorted across directory boundaries if you gave it multiple input directories. ✨
  • -i DIR, -ignore β€” Ignore a directory with this name. DIR can be a single folder name or a full path, and it's case sensitive. If you give a full path it has to match the Directory tag exactly to be ignored. Stack multiple -i options to ignore more than one name. There are two special DIR values, and they're kinda iconic: "SYMLINKS" stops it from recursing into directories that are symbolic links when you're using -r (note: this doesn't currently work under Windows 😭), and "HIDDEN" makes it ignore files whose names start with a . (aka hidden files on Unix systems) when scanning a directory. πŸ¦‹
  • -if[NUM] EXPR β€” Set a condition that gets evaluated before processing each FILE. EXPR is a Perl-like logic expression where tag names are prefixed with $. 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 can contain a hyphen. Tag names may also have a leading group name separated by colons, and/or a trailing # to disable print conversion. The expression $GROUP:all evaluates to 1 if any tag exists in the specified "GROUP", or 0 otherwise (see note 2 below). When you use multiple -if options, all the conditions have to be satisfied to process the file. If every file fails the condition, it returns an exit status of 2. Here's a lil taste of what it can do:
# 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 -if makes a separate processing pass happen just to evaluate EXPR at a -fast level given by NUM (peep the -fast option docs for the deets). Without a NUM, only one processing pass is done, at the level set by -fast. So like, -if5 is totally possible if EXPR only uses pseudo System tags, and it can speed things up big time if enough files fail the condition. ⚑

The expression gets access to the current ExifTool object through $self, and these special functions are available so you can short-circuit the file processing. Both of them return 1. Case is significant for function names, bestie, don't fumble it:

  • End() β€” end processing after this file
  • EndDir() β€” end processing of files in the current directory after this file (not compatible with -fileOrder)

Notes πŸ“

  1. The -n and -b options also apply to tags used in EXPR.
  2. The API RequestTags option is automatically set for all tags used in the -if condition.
  3. Tags in the string are interpolated in a similar way to -p before the expression is evaluated. In this interpolation, $/ is converted to a newline and $$ represents a single "$" symbol. So Perl variables, if you use them, need a double "$", and regular expressions ending in $/ must use $$/ instead.
  4. The condition accesses only tags from the file being processed, unless the -fileNUM option is used to read an alternate file and the corresponding family 8 group name is specified for the tag. See the -fileNUM option details for more info.
  5. The -a (Duplicates) option is implied when -if is used without a fast NUM, and the values of duplicate tags are accessible by specifying a group name in the expression (like a family 4 instance number, eg. $Copy1:TAG, $Copy2:TAG, etc).
  6. A special "OK" UserParam is available to test whether the previous command succeeded when -execute was used, and you can use it like any other tag in the condition (ie. "$OK").
  7. The values of undefined tags in the expression are affected by the -f and -m options, unless the API UndefTags option is also set.
  8. The condition fails if a Perl error occurs. This could happen, for instance, if an undefined value (like a missing tag) is used improperly. πŸ’€
  • -m, -ignoreMinorErrors β€” Ignore minor errors and warnings. This lets you write to files that have 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 lose you any metadata if you ignore it β€” but there are exceptions, so ExifTool leaves the final call up to you, bestie. Minor errors and warnings are marked with [minor] at the start of the message. Warnings that affect processing when ignored are marked with [Minor] (capital "M", so you know it's serious πŸ‘€). Also note this makes missing values in -tagsFromFile, -p, -if and -fileNUM strings get set to an empty string instead of an undefined value (though you can dodge that for -if using the API UndefTags option).
  • -o OUTFILE or FMT, -out β€” Set the output file or directory name when you're writing information. Without this option, whenever any "real" tags get written, the original file is renamed to FILE_original and the output is written to FILE. When you're writing only FileName and/or Directory "pseudo" tags, -o makes the file get copied instead of moved β€” but directories specified for either of those tags take precedence over whatever -o says. πŸ’…

OUTFILE can be - to write to stdout. You can also use a FMT string where %d, %f and %e represent the directory, file name and extension of FILE. Plus %c can be used to add a copy number. Peep 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 get created if needed. Existing files will not be overwritten. And if you combine -overwrite_original with -o, the original source file gets 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 then gets created from a combination of the information in FILE (as if the -tagsFromFile option was used) plus tag values assigned on the command line. And if no FILE is specified, the output file can be created from scratch using only the tags you assigned on the command line. ✨

  • -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 if you already have separate backup copies of your image files. Like, fr fr. 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 β€” Basically -overwrite_original but with an extra step that lets the original file attributes be preserved. For example, on a Mac this keeps 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 you specifically delete it 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 -overwrite_original should be used instead unless you actually need this. 🌸

Note that this option reverts to the behaviour of the -overwrite_original option when 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. FileCreateDate on Windows and Mac systems) which is not affected by this option. That creation date is preserved on Windows systems where Win32API::File and Win32::API are available, regardless of this setting. For other systems, the -overwrite_original_in_place option may be used if necessary to preserve the creation date. And the -P option is superseded by any value written to the FileModifyDate tag. πŸ’œ
  • -password PASSWD β€” Specify a password to allow processing of password-protected PDF documents. 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 churning through files πŸ’«. No colon? Then -progress just slaps a progress count in brackets right after each processed file's name, giving you the current file number and the total number of files to process. It implies the -v0 option, so the names of processed files get printed too when writing. When you combine 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 NUM is specified, progress is shown every NUM input files πŸ‘‘

Now, if it's followed by a colon (so, -progress:), the console window title gets set according to the TITLE string you gave. No TITLE? Then a default TITLE string of "ExifTool %p%%" is assumed. Inside that string: %f is 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 for the bar width in characters, or 20 characters by default if "##" is omitted), and %% is a literal % 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 -q suppresses normal informational messages, and a second -q suppresses warnings too. Error messages can not be suppressed, although minor errors may be downgraded to warnings with the -m option, which you can then suppress 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 you add "." to the option name (so, -r. or -recurse.). By default, exiftool will also follow symbolic links to directories if supported by the system, but you can disable that with "-i SYMLINKS" (peep the -i option for the deets). Combine this with -ext options to control what types of files get processed.
  • -scanForXMP β€” scans all files (even unsupported formats, wild) for XMP info unless it's already been found πŸ”. Combined with the -fast option, only unsupported file types get scanned. > Warning: it can be time consuming to scan large files. πŸ’€
  • -u (-unknown) β€” extract values of unknown tags πŸ™ˆ. Add another -u to also extract unknown info from binary data blocks. This option applies to tags with numerical tag ID's, and makes tag names like "Exif_0xc5d9" get generated for unknown info. It has no effect on information types that have human-readable tag ID's (like XMP), since unknown tags are extracted automatically from those formats anyway.
  • -U (-unknown2) β€” extracts values of unknown tags plus unknown info from some binary data blocks ✨. It's literally the same as two -u options.
  • -wm MODE (-writeMode) β€” sets the 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 tags
    • c β€” Create new tags
    • g β€” create new Groups as necessary

So 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, this causes info to be extracted from .gz and .bz2 compressed images (only one image per archive; requires gzip and bzip2 to be available) πŸ—œοΈ. When writing, it causes compressed info 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 (saving 2424 bytes when writing XMP in a file), and writes XMP in shorthand format β€” the equivalent of setting the API Compress=1 and Compact="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 arguments should not be quoted and spaces are treated as any other character. ARGFILE may exist relative to either the current directory or the exiftool directory 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 out 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, -listw and -listx options 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 -l or -v option may be combined with -listf, -listr or -listwf to add file descriptions to the list. The -lang option may be combined with -listx to output descriptions in a single language, and the -sort and/or -lang options may be combined with -listgeo (installation of the alternate database is required for the additional languages). Also, the API GeolocMinPop, GeolocFeature and GeolocAltNames options apply to the -listgeo output. 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 (like in that 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 (check the Tag Name documentation for that one). 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 β€” print the exiftool version number πŸ‘‘. You can add the -v option to print addition system information (see the README file of the full distribution for more details about optional libraries), or -v2 to 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 your "Geotime" value doesn't have a time zone in it, bestie, exiftool just assumes your local system timezone, no big deal πŸ’….

Writing "Geotime" makes it write these tags (as long as they can actually be calculated from the track log, and the destination metadata format supports them, obviously): GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude, GPSAltitudeRef, GPSDateStamp, GPSTimeStamp, GPSDateTime, GPSTrack, GPSTrackRef, GPSSpeed, GPSSpeedRef, GPSImgDirection, GPSImgDirectionRef, GPSMeasureMode, GPSDOP, GPSPitch, GPSRoll, GPSCoordinates, AmbientTemperature and CameraElevationAngle. That's a whole squad of tags, periodt. ✨

By default, in image files the tags get created in EXIF, and only updated in XMP if they already exist there. In QuickTime-format files, GPSCoordinates gets created in the preferred location (which is ItemList by default) and in XMP. But you can say "EXIF:Geotime", "XMP:Geotime" or "QuickTime:Geotime" to write only to one group. Also, "ItemList:Geotime", "Keys:Geotime" or "UserData:Geotime" will let you write to a specific location in QuickTime-format files. πŸŽ€

Heads up: GPSPitch and GPSRoll are non-standard, and you need user-defined tags to write them. Not me making the rules, just reporting them. πŸ’€

The "Geosync" tag is your bestie for specifying a time correction that gets applied to each "Geotime" value, so everything syncs up with GPS time. Like, 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? Oh they ate β€” you get piecewise linear time drift correction AND synchronization from previously geotagged images. Go read "geotag.html" in the full ExifTool distribution for the whole tea. πŸ«–

You can stack multiple -geotag options to concatenate GPS track log data. Also, one single -geotag option can load multiple track log files if you use wildcards in the TRKFILE name β€” but lowkey important: in that case TRKFILE must be quoted on most systems (Windows being the notable exception, she's built different) so the filename doesn't get expanded before exiftool even sees it. Example:

exiftool -geotag "TRACKDIR/*.log" IMAGEDIR

Track file formats currently supported: GPX, NMEA RMC/GGA/GLL, KML, IGC, Garmin XML and TCX, Magellan PMGNTRK, Honeywell PTNTHPR, Bramor gEO, Winplus Beacon TXT, and GPS/IMU CSV files. See "GEOTAGGING EXAMPLES" for examples. Also check "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 can be set to the value "geotag" so it also writes the name, province/state and country of the nearest city while geotagging. Details at https://exiftool.org/geolocation.html.

  • -globalTimeShift SHIFT β€” shifts all formatted date/time values by the amount you give, when reading. It does NOT apply to unformatted (-n) output, so don't come for me. SHIFT takes the same form as the date/time shift when writing (peep Image::ExifTool::Shift.pl for the deets), and a negative shift is 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 β€” adds features from the specified plug-in MODULE. RN, the MWG module is the only plug-in module distributed with exiftool, and she adds read/write support for tags as recommended by the Metadata Working Group. For 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. Note that this option is not reversible β€” it stays in effect until the application terminates, even across the -execute option. It's giving permanent, and it means permanent. πŸ‘‘

πŸ›  Utilities πŸ› 

  • -restore_original
  • -delete_original[!] β€” these utility options automate the maintenance of the "_original" files that exiftool creates. They have zero effect on files that don't have an "_original" copy, so don't stress. The -restore_original option restores the specified files from their original copies by renaming the "_original" files to replace the edited versions. Like, 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. So this command deletes "a.jpg_original" if it exists, right after asking "Are you sure?":

exiftool -delete_original a.jpg

These options may not be used with other options that read or write tag values in the same command, but you can combine them with options such as -ext, -if, -r, -q and -v. πŸ’…


✨ Advanced options ✨

Among other things, the advanced options let you do complex processing from a single command without needing extra scripting. This is particularly useful for implementations like Windows drag-and-drop applications. They can also improve performance in multi-pass processing by cutting down the overhead of loading exiftool for every single invocation. Efficiency icon behavior, honestly. πŸ”₯

  • -api [OPT[[^]=[VAL]]] β€” sets an ExifTool API option. OPT is an API option name. The option value gets set to 1 if =VAL is omitted. If just VAL is omitted, the option value gets set to undef if "=" is used, or an empty string with "^=". If OPT isn't specified, you get a list of available options back. The option name is not case sensitive, but the option values are β€” rude, I know. See Image::ExifTool Options for option details. This overrides API options set via the config file. Also note that the exiftool app sets some API options internally, and trying to change those via the command line will have no effect. Sorry bestie, that door is locked. πŸ”’
  • -common_args β€” says 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. And by definition, this option and its arguments MUST come after all other options on the command line. Order matters, periodt.
  • -config CFGFILE β€” loads the specified configuration file instead of the default ".ExifTool_config". If you use it, this option must come before all other arguments on the command line and it applies to all -execute'd commands. This file is what you use to create user-defined tags as well as set default ExifTool options. CFGFILE must exist relative to the current working directory or the exiftool application directory unless you give an absolute path. You can disable loading of the default config file 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 the details about the configuration file syntax. πŸ“
  • -echo[NUM] TEXT β€” echoes TEXT to stdout (-echo or -echo1) or stderr (-echo2). Text is output as the command line is parsed, before any input files get processed. NUM can 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"). Cute AND useful. πŸŽ€
  • -efile[NUM][!] TXTFILE β€” saves 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 of those 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 gets overwritten if you add an exclamation point to the option (eg. -efile!). It saves the name of the file specified by the -srcfile option if applicable. πŸ’Ύ
  • -execute[NUM] β€” executes the 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. This is how you run multiple commands from a single command line, and it's giving multitasking queen. NUM is an optional number that gets 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 β€” reads tags from an alternate source file. Among other things, this lets tags from different files 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 -tagsFromFile option is used, tags in the ALTFILE argument come from the SRCFILE that applies to the first argument accessing tags from the corresponding "FileNUM" group.

ALTFILE may also be "@" to access tags from the specified FILE, which is 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. Yes, case-sensitive. Respect the capitals. πŸ”€

The -fast option, if used, also applies to processing of the alternate files. ⚑

  • -list_dir β€” okay so instead of listing what's inside directories, this lists the directories themselves πŸ’… like, directories get treated as normal files for reading and writing purposes. Wanna fake the vibe of ls -la on Mac/Linux? this exiftool command is giving exactly that:
exiftool -list_dir -T -ls-l -api systemtags -fast5 .* *

quick breakdown bestie: -T formats the output in tab-separated columns, -ls-l is a shortcut tag, the API SystemTags option is required to extract some necessary tags, and -fast5 gets added for speed since literally only system tags are being extracted. efficiency queen ✨

  • -srcfile FMT β€” points at a different source file to be processed, based on the name of the original FILE. lowkey useful in some special situations when you're processing related preview images or sidecar files πŸ¦‹ check the -w option for the whole description of the FMT syntax. note: file name FMT strings for all options are based on the original FILE specified from the command line β€” not the name of the source file specified by -srcfile. iykyk.

example time: copy metadata from NEF files to the corresponding JPG previews in a directory where other JPG images may also exist:

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. if none of the source files exist, then exiftool just uses the first -srcfile you specified. no cap 🫢

a FMT of "@" may be used to represent the original FILE, which is super handy when you're specifying multiple -srcfile options (eg. to fall back to processing the original FILE if no sidecar exists).

when this option is used, two special UserParam tags β€” OriginalFileName and OriginalDirectory β€” get generated so you can access the original FILE name and directory 🌸

  • -stay_open FLAG β€” if FLAG is 1 or "True" (case insensitive), exiftool keeps reading from the -@ ARGFILE even after it hits end of file 😳 this feature lets calling applications pre-load exiftool, so you skip the overhead of loading exiftool for every single command. the procedure goes like this:
    1. Execute exiftool -stay_open True -@ ARGFILE, where ARGFILE is the name of an existing (possibly empty) argument file, or "-" to pipe arguments from the standard input.
    2. Write exiftool command-line arguments to ARGFILE, one argument per line (see the -@ option for details).
    3. Write -execute\n to ARGFILE, where \n represents a newline sequence. (Note: you may need to flush your write buffers here if you're using buffered output.) ExifTool will then execute the command with the arguments received up to this point, send a {ready} message to stdout when done (unless the -q or -T option is used), and continue trying to read arguments for the next command from ARGFILE. To help with command/response synchronization, any number appended to the -execute option gets echoed in the {ready} message. For example, -execute613 results in {ready613}. When this number is added, -q no longer suppresses the {ready} message. (Also, peep the -echo3 and -echo4 options for additional ways to pass signals back to your application.)
    4. Repeat steps 2 and 3 for each command.
    5. Write -stay_open\nFalse\n (or -stay_open\n0\n) to ARGFILE when done. This causes exiftool to process any remaining command-line arguments then exit normally.

the input ARGFILE may be changed at any time before step 5 above by writing the following lines to the currently open ARGFILE:

-stay_open
True
-@
NEWARGFILE

this causes ARGFILE to be closed, and NEWARGFILE to be kept open. (Without the -stay_open here, exiftool would have returned to reading arguments from ARGFILE after reaching the end of NEWARGFILE.)

Note: when writing arguments to a disk file there's a delay of up to 0.01 seconds after writing -execute\n before exiftool starts processing the command. you can dodge that delay by sending a CONT signal to the exiftool process immediately after writing -execute\n. (There's no associated delay when writing arguments via a pipe with -@ -, so the signal isn't necessary when using this technique.) ✨
  • -userParam PARAM[[^]=[VAL]] β€” sets a user parameter πŸ’– PARAM is an arbitrary user parameter name. this is an interface to the API UserParam option (see the Image::ExifTool Options documentation), and it gives you a method to access user-defined parameters in arguments to the -if, -p and -fileNUM options as if they were any other tag. appending a hash tag ("#") to PARAM (eg. -userParam MyTag#=yes) also causes the parameter to be extracted as a normal tag in the UserParam group. just like the -api option, the parameter value gets set to 1 if =VAL is omitted, undef if just VAL is omitted with "=", or an empty string if VAL is omitted with "^=".
exiftool -p '$test from $filename' -userparam test=Hello FILE

✨ Advanced formatting feature ✨

so there's this advanced formatting feature that lets you modify the value of any tag interpolated within a -if, -p or -fileNUM argument, or a -tagsFromFile redirection string 😌 tag names within these strings get prefixed by a "$" symbol, and you can apply an arbitrary Perl expression to the tag value by placing braces around the tag name and inserting the expression after the name, separated by a semicolon (ie. ${TAG;EXPR}). the expression acts on the value of the tag through the default input variable ($_), and it has access to the full ExifTool API through the current ExifTool object ($self) and the tag key ($tag). it may contain any valid Perl code, including translation ("tr///") and substitution ("s///") operations β€” but heads up: braces within the expression must be balanced. if the expression doesn't modify $_, the original tag value gets returned. the example below prints the camera Make with spaces translated to underlines, and multiple consecutive underlines replaced by a single underline:

exiftool -p '${make;tr/ /_/;s/__+/_/g}' image.jpg

an "@" may be added after the tag name to make the expression act on individual list items for list-type tags, simplifying list processing πŸŽ€ set $_ to undef to remove an item from the list. as an example, this command returns all subjects not containing the string "xxx":

exiftool -p '${subject@;$_=undef if /xxx/}' image.jpg

a default expression of tr(/\\?*:|"<>\0)()d is assumed if the expression is empty (ie. ${TAG;}). this removes the characters / \ ? * : | < > and null from the printed value. (these characters are illegal in Windows file names, so this feature is a lifesaver if tag values are being used in file names πŸ’…)

Note: the expression is not evaluated for undefined (non-existant) tags, which may have other values if either the -m or -f command-line option or the API MissingTagValue option is used. important bestie, don't forget it πŸ™ˆ

Helper functions 🧚

Note: function names are case sensitive. no shortcuts here.

DateFmt

simplifies reformatting of individual date/time values 🌸 this function acts on a standard EXIF-formatted date/time value in $_ and formats it according to the specified format string (see the -d option). to avoid trying to reformat an already-formatted date/time value, a "#" must be added to the tag name (as in the example below) if the -d option is also used. for example:

exiftool -p '${createdate#;DateFmt("%Y-%m-%d_%H%M%S")}' a.jpg

ShiftTime

shifts 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 details about shift syntax. for example, to shift a date/time value back by one year:

exiftool -p '${createdate;ShiftTime("-1:0:0 0")}' a.jpg

NoDups

removes duplicate items from a list, with a separator specified by the -sep option πŸ’œ this function is most useful when copying list-type tags. for example, the following command may be used to remove duplicate Keywords:

exiftool -sep '##' '-keywords<${keywords;NoDups}' a.jpg

the -sep option is necessary to split the string back into individual list items when writing to a list-type tag. slay 🌟

an optional flag argument may be set to 1 to cause NoDups to set $_ to undef if no duplicates existed, thus preventing the file from being rewritten unnecessarily:

exiftool -sep '##' '-keywords<${keywords;NoDups(1)}' a.jpg

ExifTool 12.64 adds an API NoDups option which makes the NoDups helper function largely redundant, with all the functionality except the ability to avoid rewriting the file if there are no duplicates β€” but with the advantage that the duplicates may 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

arguments may be added to copy or set specific tags πŸ‘‘ arguments take exactly the same form as those on the command line when copying or writing tags, but without the leading dash. for example:

exiftool -p '${previewimage;SetTags("comment=test","title<filename")}' ...

ok bestie, this is the part where we talk about Windows being Windows 😭 and also the part where the examples live β€” aka the part you're actually gonna screenshot and keep in your notes app. buckle up. πŸŽ€


πŸͺŸ WINDOWS UNICODE FILE NAMES πŸ’»

so on Windows, command-line arguments are specified using the current code page and they get recoded automatically to the system code page. cute, right? nope. because this recoding is not done for arguments in ExifTool arg files, so by default filenames in arg files use the system code page. and unfortunately these code pages are not complete character sets, so not all file names may be represented. it's giving limited. πŸ™ˆ

good news: 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 (see the -charset option for a complete list). Setting this triggers the use of Windows wide-character i/o routines, thus providing support for most Unicode file names (see note 4). but bestie, note that it is not trivial to pass properly encoded file names on the Windows command line (see <https://exiftool.org/faq.html#Q18> for details), so placing them in a UTF-8 encoded -@ argfile and using -charset filename=utf8 is recommended if possible. periodt. πŸ’…

heads up! a warning is issued if a specified filename contains special characters and the filename character set was not provided. however, the warning may be disabled by setting -charset filename="", and ExifTool may still function correctly if the system code page matches the character set used for the file names. ✨

when a directory name is provided, the file name encoding need not be specified (unless the directory name contains special characters), and ExifTool will automatically use wide-character routines to scan the directory. she handles it. πŸ‘‘

the filename character set applies to the FILE arguments as well as filename arguments of -@, -geotag, -o, -p, -srcfile, -tagsFromFile, -csv=, -j= and -TAG<=. However, it does not apply to the -config filename, which always uses the system character set. and listen: the -charset filename= option must come before the -@ option to be effective, but the order doesn't matter with respect to other options. iykyk. πŸ¦‹

πŸ“ Notes

  1. FileName and Directory tag values still use the same encoding as other tag values, and are converted to/from the filename character set when writing/reading if specified.
  2. Unicode support is not yet implemented for other Windows-based systems like Cygwin. 😭
  3. See "WRITING READ-ONLY FILES" below for a note about editing read-only files with Unicode names.
  4. Unicode file names with surrogate pairs (code points over U+FFFF) still cause problems. πŸ’€

πŸ”’ WRITING READ-ONLY FILES πŸ“

in general, ExifTool may be used to write metadata to read-only files provided that the user has write permission in the directory. but there are three cases where file write permission is also required, so listen up:

  1. When using the -overwrite_original_in_place option.
  2. When writing only pseudo System tags (eg. FileModifyDate).
  3. On Windows if the file has Unicode characters in its name, and a) the -overwrite_original option is used, or b) the _original backup already exists.

hidden files in Windows behave as read-only files when attempting to write any real tags to the file β€” an error is generated when using the -overwrite_original_in_place, otherwise writing should be successful and the hidden attribute will be removed. but the -if option may be used to avoid processing hidden files (provided Win32API::File is available):

exiftool -if "$fileattributes !~ /Hidden/" ...

πŸŽ€ 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.

ok now the fun part, the actual receipts. πŸ’–</purl>

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.


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. slay. πŸ”₯


✨ WRITING EXAMPLES ✨

okay so bestie, quick vibe check before we dive in πŸ’– if an argument has special characters like >, <, or any whitespace, you literally have to quote it. The exact quoting technique is shell-dependent, but the examples below will work for most Unix shells. With Windows cmd though? Double quotes are the move (eg. -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). no cap, that's the energy.
  • exiftool -comment= -o newdir -ext jpg . β€” Remove comment from all JPG images in the current directory, writing the modified images to a new directory. it's giving cleanup crew 🧹
  • exiftool -keywords=EXIF -keywords=editor dst.jpg β€” Replace existing keyword list with two new keywords ("EXIF" and "editor"). 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. lowkey additive queen πŸ’…
  • exiftool -exposurecompensation+=-0.5 a.jpg β€” Decrement the value of ExposureCompensation by 0.5 EV. Note that += with a negative value is used for decrementing because the -= operator is used for conditional deletion (see next example). math but make it cute.
  • 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&uuml;hl' -E dst.jpg β€” Write alternate language for XMP:Description, using HTML character escaping to input special characters. fancy ✨
  • 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. ⚠️ seriously, do not.
  • 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 bestie.
  • exiftool -all= --jfif:all dst.jpg β€” Delete all meta information except JFIF group from an image. selective deletion, iconic.
  • exiftool -Photoshop:All= dst.jpg β€” Delete Photoshop meta information from an image (note that the Photoshop information also includes IPTC). double whammy.
  • exiftool -r -XMP-crss:all= DIR β€” Recursively delete all XMP-crss information from images in a directory. recursive realness.
  • exiftool '-ThumbnailImage<=thumb.jpg' dst.jpg β€” Set the thumbnail image from specified file. (Note: The quotes are necessary to prevent shell redirection.) don't let the shell steal your thunder.
  • 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. two birds, one stone πŸ•’
  • 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.) canon girlies rise πŸ‘‘
  • 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.) group chat drama but for metadata.
  • exiftool -LightSource-='Unknown (0)' dst.tiff β€” Delete "LightSource" tag only if it is unknown with a value of 0. conditional deletion, we love to see it.
  • exiftool -whitebalance-=auto -WhiteBalance=tung dst.jpg β€” Set "WhiteBalance" to "Tungsten" only if it was previously "Auto". glow up only when needed.
  • 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". xmp files for days.
  • exiftool -o test.xmp -owner=Phil -title='XMP File' β€” Create an XMP data file only from tags defined on the command line. command line only, no extra.
  • exiftool '-ICC_Profile<=%d%f.icc' image.jpg β€” Write ICC_Profile to an image from a ".icc" file of the same name. color profile realness 🌈
  • exiftool -hierarchicalkeywords='{keyword=one,children={keyword=B}}' β€” Write structured XMP information. See https://exiftool.org/struct.html for more details. structured like a boss.
  • 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. bye bye bloat πŸ’€

✨ COPYING EXAMPLES ✨

These examples demonstrate the ability to copy tag values between files. it's giving copy-paste but make it metadata πŸ’–

  • 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. slay.
  • 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. group preservation is key.
  • 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 rebuild.
  • 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. glow-up for broken files.
  • 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. xmp files only, no image creation.
  • 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. selective copy, we love a clean destination.
  • exiftool -TagsFromFile src.jpg -title -author=Phil dst.jpg β€” Copy title from one image to another and set a new author name. author Phil has entered the chat.
  • 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. mixing sources, main character energy.
  • exiftool -tagsfromfile src.jpg -exif:all --subifd:all dst.jpg β€” Copy only the EXIF information from one image to another, excluding SubIFD tags. exif only, no subifd.
  • 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.) filesystem and metadata sync up.
  • exiftool -TagsFromFile src.jpg '-xmp:all<all' dst.jpg β€” Copy all possible information from "src.jpg" and write in XMP format to "dst.jpg". xmp everything.
  • 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. filename to description pipeline.
  • 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. translation era ✨
  • 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. cr2 to jpg glow-up.
  • exiftool '-keywords+<make' image.jpg β€” Add camera make to list of keywords. keywords plus make, cute.
  • 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". comment from exif values, iconic.
  • exiftool -TagsFromFile src.jpg -icc_profile dst.jpg β€” Copy ICC_Profile from one image to another. color profile copy, we stan.
  • 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.
  • 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 overwrites, respect the existing file.
  • 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). advanced mode activated πŸ”₯

πŸŽ€ RENAMING EXAMPLES πŸŽ€

ok so here's the thing bestie β€” you can literally rename and move files just by writing the FileName and Directory tags. no cap. it's giving organization queen, and it's especially iconic for sorting files by date when you pair it up with the -d option. πŸ’…

new directories get created as needed, but heads up: existing files will NOT be overwritten. periodt.

the format codes %d, %f and %e can be used in the new file name to represent the directory, name and extension of the original file, and %c can be used to add a copy number if the file already exists (peep the -w option for the deets). lowkey important: if you use these inside a date format string, you gotta add an extra % to pass these codes through the date/time parser. and further note (sorry, one more layer πŸ™ˆ) that in a Windows batch file, all % characters must also be escaped, so in this extreme case '%%%%f' is necessary to pass a simple %f through the two levels of parsing. yeah. two levels. we suffer together.

more 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.
  • 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.
  • 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).
  • 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.
  • 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 does geotagging from GPS log files through 3 special tags: Geotag (which, for convenience, is also implemented as an exiftool option), Geosync and Geotime. the examples below are gonna highlight some geotagging features, slay. more docs at https://exiftool.org/geotag.html.

quick aside bestie: geotagging from known GPS coordinates is done by writing the GPS tags directly, not by 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.
  • 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.
  • 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.
  • 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.
  • 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=.
  • 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.
  • 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.
  • 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.
  • 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.)

πŸ›‘ INTERRUPTING EXIFTOOL πŸ›‘

hitting exiftool with a CTRL-C or SIGINT is not gonna leave you with partially written files or temporary files chillin' on your 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 cleans up after herself, unlike some people πŸ’…


πŸšͺ EXIT STATUS πŸšͺ

the exiftool application exits with a status of 0 on success, or 1 if an error occurred, or 2 if all files failed the -if condition (for any of the commands if -execute was 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 a wrap on the whole EXIFTOOL(1) page bestie!! 🫢 this was built on perl v5.42.1 and dated 2026-03-31 β€” go forth and tag everything, you absolute legend πŸŒˆβœ¨πŸ’–

πŸ“¦ where this page comes from