Last week I came across a video presentation of Ariel Shamir and Shai Avidan’s “Seam Carving for Content-Aware Image Resizing,” a method for resizing images by slicing out or padding uninteresting strips of pixels.
If you haven’t seen this presentation on YouTube already, watch it here right now. I’ll wait.
OK. Wasn’t that sweet?
Personally, I’d love to use the method for stretching out photos I’ve taken in portrait orientation to fill my desktop wallpaper properly. When I watched this video, I was wishing that this resizing effect was available as a Gimp plug-in, or in some other form in which I could easily access it.
Then, yesterday, the Content-Aware Image Resizing video turned up on Slashdot, along with some very interesting reader comments. Two different commenters claimed to have implemented the resizing method themselves, and they both provided links to their source code.
I headed over to the blog site of one of these commenters, an Australian programmer named Andy Owen, downloaded his code (which Andy released under the GPL3), and compiled it. The code worked pretty well.
I tried this out on a picture I took of the Golden Gate Bridge, which first I scaled down to 640 pixels across (to save time) and then converted to BMP (to comply with Andy’s app).
Owen’s app only downsizes, and it only accepts 24-bit BMP files as input. What’s more, the app goes one horizontal pixel strip at a time, so I had to chef up a shell script to run the app a bunch of times in a row to achieve a noticeable result.
I Content-Awarefully Resized my picture to 437 pixels across. The picture came out looking pretty good, although the suspension cables of the bridge picked up some artifacts.
Another Slashdot commenter said that he knows a grad student of one of the presenters, and that the method was developed as a Gimp plugin initially, but that the project switched to a Windows-based application to pull off the live resizing you see in the video.
Given this alleged background for the plug-in, and the quick implementation work of Andy Owen — and perhaps others — maybe I’ll soon have this functionality for my image manipulator of choice after all.