For a while now, I’ve been sick of iPhoto. We have nearly 2,800 digital photos in our collection, and frankly, iPhoto CHOKES on them. It takes a couple minutes for iPhoto to start up, another minute for it to load albums, and god forbid I should try to insert a digital media card to import new photos, that takes another minute to come up. Then there is the process – iPhoto downloads the photos into its library at the speed of greased molasses, puts them into a “Film Roll”, and then I must sort through the images, delete the bad ones, and rotate the ones that need rotating. I also organize them into Albums, for some reason. Then, THEN! If I want to put those photos on the web, I must export them all in a smaller format, upload them to our web server, and put them into the gallery. All of this just to get photos on the web!
Now, I thought to myself, couldn’t I leverage some of those useful programming skills I’ve learned to make this tedious process easier? So I set to it.
First, iPhoto was nixed. Too slow, too painful, too buggy. Sometimes it would HANG when trying to rotate a photo.
Next, I found some tools that I could work with:
Image Magick – a set of UNIX utilities that allow you to manipulate images from the command line, as opposed to a graphical point-and-click program like iPhoto
Perl Magick – an interface from Perl to Image Magick. Perl being my native programming language, this lets me manipulate images from within Perl programs I write. It’s included with Image Magick.
Using Perl and those tools, I wrote a couple of programs:
pPhoto: This accomplishes one task, but it does it well. In one shot, it copies all of the images from my digital media card, puts them in an archive on my computer, creates web-sized copies of all the files, and uploads those copies to our web server. pPhoto can actually pull images from anywhere, not just a digital media card – so you could point it to a Photo CD, a shared folder on your network, or another folder on your hard drive. The only thing pPhoto doesn’t do is rotate our photos automatically, and discard the bad photos. The second thing we will most likely always have to do ourselves, but the first one could possibly be automated, were we using a different camera. Many of the newer digital cameras have “orientation sensors”, which will record the position the camera was being held along with the other photographic information. Using this, my program could automatically figure out which way a photo should go, and rotate it accordingly. But since my camera doesn’t do that, I have no way to test it. Therefore, rotation must be done manually as well. Fortunately, the web-based photo gallery software we use on our website is capable of deleting, rotating, and other photo manipulation, so we can mess with the photos once they are on-line.
gallerize: Since I now have a nice archive of photos on my hard disk, it would be good to have an easy way to navigate them without using iPhoto. gallerize takes a directory full of images, creates thumbnails for each image, and then creates an HTML index page so that we can view and download the full sized versions of each image.
Should I need to do any other manipulations of the images on our computer, I can simply use the ‘convert’ utility that Image Magick provides – just fire off a quick command from the keyboard, it does its work on the image, and gets out of the way. No need for iPhoto there.
Overall, these programs will reduce the amount of effort and frustration involved in importing our photos, which means all of you readers get to see our latest photos much faster.
If you’re interested in seeing the code for either of the programs I wrote, let me know. It is written and Perl and should run on any system that has Perl installed, including Mac OS X, Windows with ActivePerl, and essentially every UNIX or Linux system.