|
| 1 | +# ExifTool Cheatsheet |
| 2 | + |
| 3 | +## Basics |
| 4 | + |
| 5 | +### Show all available EXIF tags of a file |
| 6 | + |
| 7 | +```bash |
| 8 | +exiftool -G0:1 -all -a -s <filename> |
| 9 | +exiftool -G0:1 -all:time -a -s <filename> |
| 10 | +exiftool -G0:1 -alldates -a -s <filename> |
| 11 | +exiftool -G0:1 -all -a -n -JSON -api struct=2 -charset filename=UTF8 <filename> |
| 12 | +``` |
| 13 | + |
| 14 | +### Validate a file and show warnings and errors |
| 15 | + |
| 16 | +```bash |
| 17 | +exiftool -validate -warning -error -a FILE |
| 18 | +``` |
| 19 | + |
| 20 | +## Missing Metadata |
| 21 | + |
| 22 | +### Find all photos Without 'createdate' EXIF tag |
| 23 | + |
| 24 | +```bash |
| 25 | +exiftool -if '(not $createdate)' -p '$directory/$filename' -r . |
| 26 | +``` |
| 27 | + |
| 28 | +### Find all photos Without 'datetimeoriginal' EXIF tag |
| 29 | + |
| 30 | +```bash |
| 31 | +exiftool -if '(not $datetimeoriginal)' -p '$directory/$filename' -r . |
| 32 | +``` |
| 33 | + |
| 34 | +### Find all photos Without any date EXIF tag |
| 35 | + |
| 36 | +```bash |
| 37 | +exiftool -if '(not $datetimeoriginal) and (not $createdate)' -p '$directory/$filename' -r . |
| 38 | +``` |
| 39 | + |
| 40 | +### Find all photos without GPS location tag |
| 41 | + |
| 42 | +```bash |
| 43 | +exiftool -if 'not $gpslatitude' -p '$directory/$filename' -r . |
| 44 | +``` |
| 45 | + |
| 46 | +## Metadata Cleanup |
| 47 | + |
| 48 | +### Update DateTime if it doesn't exist |
| 49 | + |
| 50 | +```bash |
| 51 | +exiftool -q -if 'not $DateTimeOriginal' -r -p 'Setting DateTimeOriginal for: $directory/$filename' -overwrite_original -DateTimeOriginal=XXXX |
| 52 | +``` |
| 53 | + |
| 54 | +### Import all image data from JSON files (from Google Takeout), and write to EXIF data of corresponding photos |
| 55 | + |
| 56 | +```bash |
| 57 | +exiftool -overwrite_original -v -r -d %s -tagsfromfile '%d/%F.json' '-GPSAltitude<GeoDataAltitude' '-GPSLatitude<GeoDataLatitude' '-GPSLatitudeRef<GeoDataLatitude' '-GPSLongitude<GeoDataLongitude' '-GPSLongitudeRef<GeoDataLongitude' '-ModifyDate<PhotoTakenTimeTimestamp' '-CreateDate<PhotoTakenTimeTimestamp' '-DateTimeOriginal<PhotoTakenTimeTimestamp' -ext jpg -overwrite_original |
| 58 | +``` |
| 59 | + |
| 60 | +### Remove ALL metadata from a file |
| 61 | + |
| 62 | +```bash |
| 63 | +exiftool -overwrite_original -all= <filename> |
| 64 | +``` |
| 65 | + |
| 66 | +### Add CreateDate Exif Property and Copy DateTimeOriginal Exif Property Value into It |
| 67 | + |
| 68 | +Useful for if many pictures do not have the CreateDate exif-property, but do have the DateTimeOriginal exif-property. If you want the CreateDate exif-property to have the same value as the DateTimeOriginal exif property: |
| 69 | + |
| 70 | +```bash |
| 71 | +exiftool -overwrite_original '-createdate<datetimeoriginal' -r -if '(not $createdate and $datetimeoriginal)' <your directory> |
| 72 | +``` |
| 73 | + |
| 74 | +## Face Tags |
| 75 | + |
| 76 | +### Find all photos that have NO Microsoft Face tag but HAVE an XMP-MWG Face tag, and add a keyword to those |
| 77 | + |
| 78 | +```bash |
| 79 | +exiftool -r -ext jpg -overwrite_original -m -v -if '($RegionName) and (not $RegionRectangle)' -Keywords+='Has-MS-Face-but-no-XMP-face' . |
| 80 | +``` |
| 81 | + |
| 82 | +### Find all photos that have NO Microsoft (MXP-MP) Face tag but HAVE a name in the Digikam /Mensen/ tree |
| 83 | + |
| 84 | +```bash |
| 85 | +exiftool -p '$directory/$filename' -r -if '($XMP-digiKam:TagsList=~/INSERT-NAME-HERE/i) and (not $RegionPersonDisplayName=~/INSERT-NAME-HERE/i)' . |
| 86 | +``` |
| 87 | + |
| 88 | +### Find all photos that have NO Microsoft (MXP-MP) Face tag but HAVE a name in the Digikam /Mensen/ tree and add a tag to those |
| 89 | + |
| 90 | +```bash |
| 91 | +exiftool -r -ext jpg -overwrite_original -m -if '($XMP-digiKam:TagsList=~/INSERT-NAME-HERE/i) and (not $RegionPersonDisplayName=~/INSERT-NAME-HERE/i)' -XMP-digiKam:TagsList+='Check' . |
| 92 | +``` |
| 93 | + |
| 94 | +### Create a .txt file with all photos, and listing who is on which photo (face tags) |
| 95 | + |
| 96 | +```bash |
| 97 | +exiftool -T -Directory -Filename -RegionPersonDisplayName -r -ext jpg . > PeopleTags.txt |
| 98 | +``` |
| 99 | + |
| 100 | +## Organize |
| 101 | + |
| 102 | +### Rename file to CreateDate of images. This will change the file names to something like '20221028-150847.jpg' |
| 103 | + |
| 104 | +```bash |
| 105 | +exiftool -v '-filename <${CreateDate}.%e' -d %Y%m%d-%H%M%S . |
| 106 | +``` |
| 107 | + |
| 108 | +### Write all (incl. GPS location) tags FROM .mp4 files TO corresponding XMP files |
| 109 | + |
| 110 | +```bash |
| 111 | +exiftool -v -v -r -ext mp4 -overwrite_original -tagsfromfile %d%f.mp4 -all:all -xmp:all -exif:all -composite:all -quicktime:all -iptc:all -gps:all %d%f.xmp . |
| 112 | +``` |
| 113 | + |
| 114 | +### Write all (incl. GPS location) tags FROM .xmp files TO corresponding MP4 video files |
| 115 | + |
| 116 | +```bash |
| 117 | +exiftool -v -r -overwrite_original -tagsfromfile %d%f.xmp -all:all -xmp:all -exif:all -composite:all -quicktime:all -iptc:all -gps:all -ext m4v -ext mov -ext mp4 -ext avi . |
| 118 | +``` |
0 commit comments