Renaming photos


A family gathering with ten different photographers shotting every moment. You end up with thousands of photos that need to be organized at least in sequence over the time (to make a slide-show, for example).


Some cameras name the photos as IMG_XXXX, others as DSC-XXX, etc. Without proper organization, you can’t simply view the photo in a time organized sequence.


Most digital cameras record the date and time in the photo exif header. The idea is to use this information to rename the photo according to the date and time when it was taken. Once the photos are renamed with the proper name format, it becomes easy to make them into a sequence.


First, you’ll need the jhead program installed apt-get install jhead (on Debian/Ubuntu). This simple program does all the work for you. Just launch:

jhead -nf%Y%m%d-%H%M%S-photographerName *.jpg

in the directory of each photographer. Then, you can copy all photos within the same directory.

All cameras might not be set properly. There will at least be few minutes of difference between them. It can be few years if one camera time has not been set before. Choose one reference camera (enough shots in the series with a correct time) and try to estimate the time-difference with others. Then jhead can help you to change the exif header according to your evaluation:

jhead -da2006:08:05+17:41:40-2006:08:05+11:39:06 *-photographerName.jpg

to add about 6 hours and 2 min to all shots taken by photographerName in the series. The second argument (2006:08:05+11:39:06) is the current date-time of one of the shot. The first argument (2006:08:05+17:41:40) is the date-time according to the reference camera. All shots will be incremented by this difference.

Once the time is corrected, you need to rerun the renaming

jhead -nf%Y%m%d-%H%M%S-photographerName *-photographerName.jpg

One thought on “Renaming photos

Leave a Reply

Your email address will not be published. Required fields are marked *