Skip to content

Instantly share code, notes, and snippets.

@gizotso
Last active February 2, 2024 02:35
Show Gist options
  • Save gizotso/1addceb9f14d75f51a5d42441552a925 to your computer and use it in GitHub Desktop.
Save gizotso/1addceb9f14d75f51a5d42441552a925 to your computer and use it in GitHub Desktop.
exiftool

List exif informations

# -s : Short output format
exiftool file.jpg -s
exiftool file.jpg -AllDates
exiftool file.jpg  -FileModifyDate
exiftool file.jpg -DateTimeOriginal
exiftool 20170411_220635.JPG -s | grep Date

exiftool -p "$DateTimeOriginal" "Photo - 01.JPG"

Commonly, in JPEG images, the DateTimeOriginal, CreateDate and ModifyDate values must all be changed. For convenience, a shortcut tag called AllDates has been defined to represent these three tags. --> AllDates is a shortcut for 3 tag names: DateTimeOriginal, CreateDate and ModifyDate.

Use -overwrite_original option to overwrite image file

list all tags that contain date

exiftool "-*date*" "Photo - 01.JPG"

Shift Dates

  • exiftool.exe "-DateTimeOriginal+=Y:M:D h:m:s" filename.jpg
  • exiftool.exe "-AllDates+=Y:M:D h:m:s" filename.jpg

ajouter un an

exiftool -AllDates+='1:0:0 0' picture.jpg
exiftool -AllDates-=00:00:00 1:00:0" *.JPG

reculer d'une heure

exiftool "-AllDates-=00:00:00 1:00:0" *.JPG
exiftool -AllDates-=1 *.JPG

reculer de n jours

exiftool "-AllDates-=0:0:58 0:0:0" "C:\Photos\file.jpg"
exiftool -overwrite_original "-DateTimeOriginal-=0:0:55 0:0:0" *.JPG

shifting

exiftool "-AllDates-=17:11:15 00:00:0" *.JPG
exiftool "-AllDates+=1:11:23 6:30:0" *.JPG
exiftool -overwrite_original "-DateTimeOriginal-=0:0:6558 0:0:0" *.JPG
exiftool -overwrite_original "-CreateDate-=0:0:6558 0:0:0" *.JPG
exiftool "-DateTimeOriginal-=12:07:00" "-CreateDate-=12:07:00" test.jpg

Say for example that your camera clock was reset to 2000:01:01 00:00:00 when you put in a new battery at 2005:11:03 10:48:00. Then all of the pictures you took subsequently have timestamps that are wrong by 5 years, 10 months, 2 days, 10 hours and 48 minutes.

exiftool "-DateTimeOriginal+=5:10:2 10:48:0" DIR
exiftool "-DateTimeOriginal-=18:00:0 00:00:0" DIR
exiftool "-DateTimeOriginal-=17:11:15 00:00:0" DIR

Change date

Set DateTimeOriginal to Any Arbitrary Timestamp YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z])

exiftool "-DateTimeOriginal=2008:12:25 12:00:00" 20170103_180336.jpg
# update CreateDate with content from DateTimeOriginal
exiftool "-DateTimeOriginal>CreateDate" 20170103_180336.jpg
exiftool -AllDates 20170103_180336.jpg

Rename files

http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2576.0

exiftool '-FileName<CreateDate' -d %Y%m%d%-3nc.%%e `exiftool -createdate -filename -T -ext cr2 . | sort | awk '{print substr($0,index($0,"\t")+1)}'`
ls -lt|exiftool '-FileName<CreateDate' -d %Y%m%d%-3nc.%%e

Exif tool

exiftool(-k).exe : http://www.sno.phy.queensu.ca/~phil/exiftool/

Install/Setup : rename exiftool(-k).exe into exiftool.exe and add exiftool.exe location in the windows env PATH variable (to have it available from the windows prompt from any directory and be able use exiftool to call it instead of "exiftool(-k).exe") Or use the full path to the exe : "C:\Toolls\exiftool\exiftool.exe"

References :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment