Content-aware image resizing

There is currently a lot of hype around this paper by Dr. Ariel Shamir and Dr. Shai Avidan. Honestly — it really kicks ass. This is a realy nice idea and I can absolutely understand Adobe just hired one of them direclty. Now there is a online demo of this available. Unfortunately it misses some source-code to look into and possibly optimize it.

So I did my own version. Basically this is a slim-version of the original technique. Image is converted to grayscale and a convolution matrix is used to find the pixel’s energy levels. Then the seams are created as the paper describes it … sort of :-). At the end the seam with the lowest energy is picked and removed.

The code is very ugly, not documented at all and not optimized. But it is also saturday night and I should be out drinking a beer already. You can press a key in the online demo to change the scale direction or click to reset it. If you can improve something do not be shy and post it.

Update: Here is another demo that shows the effect even better.

Update 2: Make sure to follow the joint venture from Mario and me.


  1. Posted Sep 25, 2007 at 2:10 am | Permalink

    If you are looking for a software to try out seam carving, maybe you also want to take a look at

    The program that you can download there (for Windows and Linux, and free) is already highly optimized concerning speed, and apart from enlarging or decreasing image size you can also use masks to protect or delete certain parts of your image.

    Have fun,

  2. Posted May 1, 2008 at 8:19 am | Permalink

    The demo shown are quite impressive and the source code is too clumsy one. Let me give a try again and then a nice comment here.

11 Trackbacks

  1. By Links: September 3, 2007 « SmoothSpan Blog on Sep 2, 2007 at 10:52 pm

    […] by smoothspan on September 2nd, 2007 Awesome Context Aware Image Sizing:  Lots of people are talking about this Truly Great Innovation for photo editors!  Hope for it in PhotoShop […]

  2. […] Content-aware image resizing ( Joa Ebert blog) […]

  3. […] joa ebert has been busy trying to recreate the same technology but using flash and fliker feeds – check his blog. […]

  4. By Seam Carving, les plugins | Korben's Blog on Sep 19, 2007 at 7:50 am

    […] Pour Flash (ActionScript) ici et là aussi […]

  5. By A Source Of Inspiration - Flash Seam Carving on Sep 24, 2007 at 12:00 pm

    […] a lot of buzz last month. It was just a matter of time until someone ported it to Actionscript 3. Joa Ebert and then Mario Klingemann posted their Image Resizing classes. Perhaps it’s time to start […]

  6. By Content-aware image resizing on Sep 30, 2007 at 6:04 pm

    […] Quasimondo – actionscript bron bestand […]

  7. […] del codice Actionscript utilizzato, che è alla base di Rsize, vi consiglio di andare nel sito di Joa e […]

  8. By Remote Sensing Tools on Oct 10, 2007 at 2:33 pm

    Seam Carving Round-Up…

    There’s been a great deal of buzz for a couple months, concerning a technology known as Seam Carving — also being refered to as Content Aware Image Resizing or Aware Image Resizing. I’ve been experimenting with this for a while, and I…

  9. By seam carving bis repetita | HIDIHO! on Aug 26, 2008 at 10:01 am

    […] is seam carving? – a kick ass algorithm, alreadyported a couple of […]

  10. By Daily Digest for 2009-01-12 | Pedro Trindade on Jan 13, 2009 at 10:21 am

    […] Content-aware image resizing at – Blog of Joa Ebert […]

  11. By trop bien le blog » seam carving ( 1/3 ) on Feb 26, 2009 at 12:21 pm

    […] qui est tu seam carving ? – un algo de ouf, déja porté par des oufs impressionnat hein?! vas y fait pas le blasé. ou la blasée d’ailleurs. Seam en […]