I've got a huge number of digital photos on my computer that need to be organized. What I would like to do is sort the pictures by the date they were taken. The first step to sorting the pictures is to know the date they were taken. As long as the clock is properly set on your camera, your pictures should have the correct date and time of the photo stored in the image's EXIF data. You can view an image's EXIF data using the identify command.
The identify command is part of the Image Magick package. If it's not installed on your system, check your distro's repositories. In Ubuntu you can install it with:
Now that Image Magick is installed, you can view the EXIF data for your images.
Now in my case I'm just interested in the date and time the picture was taken. I can view that information with this command.
The output looks like this.
This means that the picture was taken at 6:48:05 PM on April 4, 2009.
Now that I can view the date, it should be possible to write a script to sort the images into folders by year and month.
#
Using IM for reading EXIF is very slow because IM loads the whole image to read the EXIF data. Not a big problem if used with small JPGs but try to load a 20 Mpix NEF or DNG. It would take about a minute or more.
#
If you have edited some photos, the %[EXIF:DateTime] field will probably show the date and time of last edition. In that case use %[EXIF:DateTimeOriginal], which will show the date the photo was actually taken.