Content Aware Image Resizing, also known as Seam carving and content-aware scaling, is a way to re-size an image without modifying its content ratio. The algorithm resizes images non-uniformly and while doing so, magically preserves the content of the image by getting rid of unimportant areas. The purpose of the algorithm is to display images without distortion on various media using document standards, like HTML, that already support dynamic changes in page layout and text, but not images.
The algorithm was first explained by Shai Avidan and Ariel Shamir and published in 2007. Since then several excellent implementations have been released including a plugin for The Gimp and CAIR, a standalone application in C++. Content-aware scaling was also incorporated into Adobe Photoshop CS4.
Content Aware Image Resizing can be understood by the following example.
Below is a picture of Broadway Tower in England. We need to reduce the width of this image.
On the left is what happens when you reduce the width of the picture by scaling. On the right, is the result of seam carving.
Seam Carving GUI is a GUI front end to CAIR. The program resizes images by automatically detecting “seams” – paths of minimum change from one end of the image to another, and then by removing the seams from the image. There is an option to manually mark the regions to keep and the regions to remove, but it generally produces worse results. To guide you in this process the program can show you energy density of the image.
The success of seam carving will vary from image to image. Pictures, like the one showed in the example above, is ideal for seam carving. Images with lot of content are not. If you aren’t asking for too much, choose images wisely and understand the limitations of the program, Seam Carving GUI can produce excellent results.
Examples of good scaling
Example of bad scaling
Photo credits: danichtfür, Miroslav Petrasko, perkijl61
Be the first to comment