The Pug Automatic

Reversing the Photo Booth twirl effect with Photo Rebooth (or: The two-way fun house mirror)

Written December 30, 2006. Tagged OS X, Cocoa, Quartz Composer.

The application Photo Booth comes pre-installed on recent Macs and allows you to take stills with the built-in iSight web cam. You can add silly distortion effects, for hours of fun.

The other day, I realized it would be cool if there was some way to provide such a distorted image as input and get an undistorted image as output – people do some weird posing in front of fun house mirrors.

Having toyed a little with Quartz Composer before, and knowing the Photo Booth effects are implemented with it, I opened up /Applications/Photo Booth.app/Contents/Resources/Video.qtz and poked around. I found that the twirl effect could easily be reversed by running the image through a counter-twirl.

Alas, I was not able to reverse any other effect very successfully. Possibly the twirl is the only (almost) lossless and easily reversible effect. Please let me know if you manage to reverse any of the others.

Since I have been wanting to try Cocoa programming for some time, I wrapped my untwirler composition in an application – Photo Rebooth (download, source).

Drag a twirled JPG to the application in the Finder or in the dock, or to the image display area, or open it through the menu or the prominent button. The untwirled image will be displayed. There is currently no way to export the untwirled image (other than by screenshot).

For untwirl fodder, some of the images from this Flickr set are fun.

Update 2007-01-01

Version 1.1:

  • Input images no longer have to be 640x480 pixels.
  • Input images may be drag-and-dropped onto the image display area.