Παράκαμψη προς το κυρίως περιεχόμενο
lourdas.eu
  • Βιογραφικό (CV)

Use exiftool to rename your photos

Είστε εδώ

  1. Αρχική
  2. Ιστολόγια
  3. Το ιστολόγιο του/της Βασίλης
Κυρ, 12/07/2009 - 10:02ΜΜ Βασίλης

It's annoying to have a bunch of photos with names such as DSC_wxyz.JPG where wxyz integers... My D60 happens to start from the beginning (that is 0001) when I delete all photos from the memory card. So, you take your photos and when you connect the camera to the PC to download them, you discover that your new DSC_0001.jpg file will overwrite your older DSC_0001.jpg if you have not anticipated the creation of folders for each case/event. Besides, DSC_0001.jpg provides 0 (zero) information about the actual photo.

So, enough of this! I searched a bit and discovered exiftool, a handy Perl script that reads the EXIF information (and several other vendor specific tags from the photos). So, the first thought I made was "what is the EXIF feature/tag that uniquely identifies a photo?". The answer was that a good candidate is the time the photo was taken. So, with a minimal Bash script, I can now rename all those DSC_ useless filenames to something like 20090712214512.jpg, which is the concatenated timestamp of the photo (year + month + day + hour + minutes + seconds). You must be a bit unlucky (and have a modern camera) to have two or more photos with the same timestamp (taken at the same second), but with a little tweaking, the script can also be modified to consider this case.

So, the following command will display the EXIF date and time the picture was taken:

$ exiftool -EXIF:DateTimeOriginal DSC_0028.jpg
Date/Time Original              : 2009:01:04 14:18:26

You can now get this timestamp and convert it to a more compact form:

$ exiftool -EXIF:DateTimeOriginal $i|awk '{print $4":"$5}'|tr -d :

This will give you something like

20090104141826

which is good enough for me to uniquely identify my photos.

υπολογιστές / computers: 
ΕΛ/ΛΑΚ (FOSS)
  • Ιστολόγιο του χρήστη Βασίλης

αναζήτηση

Σύνδεσμοι / Links

e-tameio.eu
Ένωση Πληροφορικών Ελλάδας
Hire me in Freelancer
View Vasileios Lourdas's profile on LinkedIn

Το PGP κλειδί μου / My PGP key

Κατεβάστε το PGP δημόσιο κλειδί μου από εδώ.
Download my PGP public key from here.

PayPal δωρεά / PayPal donation












Creative Commons License
This website by Vasilis Lourdas is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.