

Preserve the important parts of the image (i.e. We might want to set up several requirements to the resizing process in this case: Imagine we have a 1000 x 500 px picture, and we want to change its size to 500 x 500 px to make it square (let's say the square ratio would better fit the Instagram feed).

In this particular case, the left image looks more natural since the proportions of the balloons were preserved. The example below shows how the original image width was reduced by 50% using content-aware resizing (left image) and straightforward scaling (right image). To preserve the proportions of the objects while changing the image proportions we may use the Seam Carving algorithm that was introduced by Shai Avidan and Ariel Shamir. reducing the width while keeping the height) and when losing some parts of the image is not desirable.ĭoing the straightforward image scaling in this case would distort the objects in it.

Another point that drew my attention (as a creator of javascript-algorithms repo) was the fact that the Dynamic Programming (DP) approach might be smoothly applied to solve it. There are many great articles written about the Seam Carving algorithm already, but I couldn't resist the temptation to explore this elegant, powerful, and yet simple algorithm on my own, and to write about my personal experience with it. About There is an interactive version of this post available where you can upload and resize your custom images.
