n8blog
distraction in action

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com

There are lots of great iPhoto export plugins out there. There's FlickrExport, iPhotoToGallery, Photon, and so on and so on. Each of these has a specific job and performs it admirably. However, there are times when your needs are more specialized and you just have to do your own thing. That's where ScriptExport comes to the rescue.

ScriptExport allows you to “export” your iPhoto pictures and movies by processing them with shell scripts. You can specify up to three scripts:

  • Preflight Script: This is run first
  • Per-Item Script: This is run once per photo or movie selected
  • Postflight Script: This is run at the end of the export

Any or all of the scripts can be left blank (though if you left all of them blank it wouldn't be very useful).

How is this useful? Well, in my last post I discussed the need to convert images to sRGB color space when uploading them to be viewed on the web. I normally use iPhotoToGallery to post my photos, but it doesn't have the ability to do color space conversions. Sure, I could have exported the photos as files and run them through an automator action or something, but then I would have lost all the captions I'd added in iPhoto. I probably could have written something in applescript to process the files, but I deeply abhor applescript.

My solution was to use ScriptExport and a Python script: export2gallery.py. It builds on a mildly-hacked version of gallery-0.2.py (my hacked version is here). For each image file, it uses the sips tool to convert the file's colorspace and dumps the file's metadata to a sidecar file. During the postflight stage it uploads all the converted files to my gallery, setting the metadata fields appropriately. If you're interested in using ScriptExport with Python then export2gallery should give you a pretty good idea of how to go about it.

If you want to be notified when ScriptExport is updated, subscribe to the ScriptExport RSS “Appcast” with your favorite RSS reader.

Finally, I'd like to point out that the source is available, licensed under the LGPL. I think it should serve as a decent example for anybody trying to build their own iPhoto export plugin.

  • Share/Bookmark

  Comments:

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Please type this word with the letters reversed: live

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com