lundi 10 septembre 2007

Sort JPG images by EXIF date in Ruby

Everybody now has a digital camera, and, during special events everybody takes plenty of pictures, and you end up with all these JPG images from different cameras. Each set of pictures tells the same story from the beginning, so it would be great to be able to reinterleave all of them in order to tell one single story.

That what the folllowing little Ruby script does, thanks to the libexif-ruby library. If you run it in a directory with JPG images, it will create a subdirectory and copy all images, renaming them, prefixing with the EXIF date set by the camera.

First, install the libexif-ruby library. On Ubuntu you can type :

Then copy the following script in a ruby script file :

1 commentaire:

Stephane a dit…

I'm not sure, but it looks like the "Date and Time" exif information could not be found in your picture.

Maybe you could try the 'exif' command line utility on your pictures to check the presence of the "Date and Time" entry.