iPhoto landscape/portrait filtering - Automator

Generally speaking, I find that the built-in utilities offered by iPhoto are more than sufficient for my day to day requirements, but today I started noticing a little problem. I couldn't find any way to filter my photos by orientation. Most of the time this isn't an issue, but I'm finding that I am using the iPhone more and more as the tool of choice for showing off some photos, and while the auto rotate feature is cool, sometimes I'd rather have a set of albums filtered by orientation so that I don't have to keep switching the orientation of the iPhone.

So a little poking around the web show that it apparently can't be done easily. Although I think that it could be accomplished directly using Applescript since I see that there are more options built-into the scripting library than I remember seeing the last time I visited.

But for some reason I was struck by the idea of using Automator to do this as it's going to become the kind of repetitive task that's a PITA, as I'll want to automatically clear an album of photos and then refill it with the latest photos in a given orientation and then sync with the iPhone. Using Automator I build some quick and dirty little workflows without delving into Applescript for each modification.

It turns out that there's no built-in action in Automator to let you do this kind of thing, so I started poking around a bit and discovered that writing Automator actions is actually pretty easy, and you can even develop them using Applescript. Now Applescript can be (and in this case is very) pokey, but for something I don't really care about performance that I can fire off every once and a while, I thought this would make an interesting little project.

Popping over to the Apple developer site, I found this useful little tutorial, that is also available for other development flavours like Cocoa.

Running through it I came up with a simple method of creating a pair of Automator filter actions - Filter Landscape and Filter Portrait. The performance is horrible - here's a snapshot of the job run to traverse an album of 2,540 pictures. But it's simple and it works. I should probably go back and revisit some other methods of determining the picture dimensions other than asking iPhoto via Applescript to see if I can't squeeze out some better performance. But for many people this would be a one-shot deal and you don't have to do it twice, since you can create a smart album that is contains everything from the original album that doesn't appear in the landscape album to get back all of the portrait images.

Long time running

Doh! - Ignore that mismatch in the titles in the screen capture - I duplicated the landscape filter xCode project and that was a test build that I was running - I hadn't chased down all of the string instances of the word Landscape.


Anyway, they're current available on the wiki side of the site here.

Comments

/groups/infrageeks/search/index.rss?sort=modifiedDate&sortDirection=reverse&tag=virtualisationlist/groups/infrageeks/search/?sort=modifiedDate&sortDirection=reverse&tag=virtualisationVirtualisationCustomTagSidebarCustomTagSidebar?sort=modifiedDate&sortDirection=reverse&tag=virtualisation0/groups/infrageeks/sidebar/CustomTagSidebarmodifiedDate5CustomTagSidebarreversevirtualisationVirtualisationcustom/groups/infrageeks/search/index.rss?tag=hotlist/groups/infrageeks/search/?tag=hotWhat’s HotHotListHot!?tag=hot0/groups/infrageeks/sidebar/HotListNo items tagged with hot.hot/groups/infrageeks/search/index.rss?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomelist/groups/infrageeks/search/?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomeRecent ChangesRecentChangesListUpdates?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcome0/groups/infrageeks/sidebar/RecentChangesListmodifiedDateallRecent ChangesRecentChangesListUpdateswiki/welcomeNo recent changes.reverse5search