Monday, August 10, 2009

How to Get Your iPhone Photos to Sort Chronologically

Please note that I am using iTunes running on Windows Vista to sync photos onto my iPhone 3GS. Just a heads-up. Most notes will still apply to other setups.

I don't know about the rest of you, but I prefer all my photos to be sorted in chronological order. This is particularly true when it comes to my iPhone. I don't usually sit and watch a slide show or even flip through multiple pictures. What I often do, though, is think of a picture I want to show somebody and scan through my photo library (several hundred photos) until I find it. Having every picture sorted by the date it was taken makes this task much easier. I won't go into the intricacies of how iTunes decides to order your photos when putting them on the phone. I've done hours of experimenting, and the easiest thing to say is that it tends to sort of try to keep them in whatever order you sorted the folder the last time you looked at it in your Windows folder browser. I'm being intentionally vague here because that seems to be howApple decided to implement this feature. Whatever it really does (random number generation, contacting Steve Jobs behind the scenes for input, etc.) makes no sense at all, but it must be some strange interaction between iTunes and Vista.

Anyways, the solution I use is the following. Since I organize my photos with Google Picasa, I simply add all the pictures I want to put on my iPhone to an album for that purpose. Then, I select and export them to a single folder. During this process, I opt to shrink the photos down to a smaller size to conserve space. Regardless, these steps aren't that important. You just need to get all the photos you want on your phone into a single folder. Then, I rename the files with the date and time they were taken so that, when sorted by name (Windows default), they are in chronological order.

Of course, I don't sit there for hours renaming. There wouldn't be much point in blogging about that. I found a free program called Siren that can do it for me. Siren has many, many features and can be a little confusing to use at times, but I'll give you a simple command-line that you can execute. Let's assume that your photos are all .jpg and reside in a folder called "C:\Temp\iPhone Photos". Note that the folder should contain a COPY of your photos and NOT THE ORIGINALS just in case something goes wrong. You can run the following from the command line:

"C:\Program Files\Siren\Siren.exe" /D "C:\Temp\iPhone Photos" /N /E "%%Xdo.jpg" /S "*.jpg" /R /Q

It looks complicated, but all it does is execute Siren on the contents of the folder with a few key options enabled. Each .jpg file within will be renamed with the date and time (24-hour) the photo was taken. For example, a photo take August 2nd, 2009 at 8:41:46 AM would become "20090802_084146.jpg". Note that the date is in kind of a funky order (year, month, day) depending upon what you're used to. This is just so that Windows and iTunes/iPhone will sort it properly. That's all there is to it. You now have a folder of photos named in chronological order just waiting to be synchronized to your iPhone. You can add more photos later and run the program again.

PS - In the off chance that you somehow have two photos taken at the exact same second, I would just use a free program like Exifer to change the date/time metadata of one of the photos to be a second earlier or later.

5 comments:

Patrick said...

Hi Craig
This is good information. What I want to do is modify the order and preserve that sequence when I export from Picassa and when I sync to my iphone. Any suggestions?

Thanks,
Paddy Moore

Craig said...

The key is that the iPhone seems to only sort by file name. That's why naming the files with a properly formatted date string leads to the pictures being sorted in chronological order. So, you should be able to simply rename the files and they will sort according to the new names.

Chris_c81 said...

Thanks for this guide. Out of curiosity, what resize/compression settings do you opt for when exporting? Thanks.

Craig said...

If I'm exporting for the iPhone/iPad, I select the resize to 1024 option. To me, they look pretty good on the small screen and don't take up much space at that setting.

Sorry for the confusion with your post. I have the blog set up so that I have to approve every post because most of them are spam.

Craig said...

A note that I'm still using this same process (now in Windows 7) almost 2 1/2 years later. It just works, and it's easy. Though, if I need to change the exif data on a photo now, I can typically use Windows 7 and skip Exifer.