0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rename JPG images in a directory based on the date in the file's mtime field. By default the target file names are in the same format as those created by Android devices.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.0.1
~> 3.12

Runtime

 Project Readme

DEPRECATION NOTICE!!!

While struggling to get my environment stable after a long time away from Ruby, I decided to port the code into a language that I am more familiar with. Going forward the officially supported version of the app will be written in Nodejs, and is available here

Photo Renamer

Gem Version

What the script does

This script is fairly specific. It renames all JPG files (technically files with a .jpg or .jpeg extenstion) in a given directory to the form IMG_yyyymmdd_hhmmss.jpg

Rationale

The naming pattern described above is the naming pattern used by the stock Android camera. Renaming photos taken with other devices to this scheme allows me to seamlessly merge photos into a single directory and maintain consistent file names.

Extracting the date

exif meta data

Per default we now use the JPEG exif meta data to find the creation date of the file. This gives much more reliable results than using the mtime of the file.

Read this blog entry if you are interested in why this was an important change for me.

mtime

It is still possible to find the date with mtime using the -f command line switch, but using the exif metadata is the highly preferred method.

After some experimenting I found that if I copy photos from my camera's memory card to my PC the "Modify Time" field gets preserved. Therefore I use this field as the basis for renaming the files. Obviously if you modify the file before renaming the mtime field will get updated and your file name will be wrong, so be warned!

IMPORTANT NOTE Since I am renaming files based on the date created by the device that captured the image, this device's date should be correctly set. (For the next release I want to add more options to manually set the date)

Installation

Dependencies

Since version 0.1.0 we use exif metadata to get the file creation date by default. We use the ruby library mini_exiftool which has a dependency on exiftool.

exiftool should be easily installable through the package manager of most distributions.

Arch Linux

pacman -S perl-image-exiftool

Ubuntu

apt-get install libimage-exiftool-perl

OSX

http://www.sno.phy.queensu.ca/~phil/exiftool/ExifTool-10.00.dmg

Windows

http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool-10.00.zip

Ruby Gems

The easiest way to install the script is by using rubygems.

gem install photo_rename

img

Usage

photo_rename photo_directory

img

Change log

0.1.1

  • Remove some debug output

0.1.0

  • Use mini_exiftool to get the date from image metadata
  • Removed -b command line option, as this is not implemented yet

0.0.4

  • Do not rename files that are already in the correct format.

0.0.1 - 0.0.3

  • Sort out teething problems with gem.

License

This program is licensed under [(http://www.gnu.org/licenses/gpl-3.0.txt)[GNU GPL]]