Seam Carving for the web

Hey,

Since it appeared on the first page of TechCrunch and Digg, seam carving based image resizing seems to have garnered enough attention to trick any coding enthusiast into coming up with an implementation of the algorithm. A little research, and I found a some source code and interesting examples here, here and here.
I got a little curious and started a little exploration. A couple of hours, and I was finally able to get my own version of the filter to find the energy function of the image. A little more coding, and JavaScript seemed to be stretching to its maximum. By the time the sobel filter was complete, the browser started throwing up the "Script taking too long to execute error".
This is where I had to backtrack a little and get some server side that would compute the seams. The only responsibility that JavaScript now holds is to fetch the seams from the server, given an image, and remove the seams.
Here is the workspace



You could use the build.xml with ant to see this in action.
Some enhancements that remain to be done are
  • convert this to a full fledged demo
  • extract this to a independent library, so that this can be used unobtrusively in HTML
  • horizontal seam
  • image expansion
So keep watching this for updates.