{"repo":"trekhleb/js-image-carver","free":true,"listed":false,"github":"https://github.com/trekhleb/js-image-carver","clone":"git clone https://github.com/trekhleb/js-image-carver.git","description":"🌅 Content-aware image resizer and object remover based on Seam Carving algorithm","language":"TypeScript","stars":1594,"topics":["javascript","image-processing","seam-carving","resize-images","image-manipulation","algorithms","algorithm"],"license":"MIT","category":"media-processing","readme_excerpt":"JS IMAGE CARVER Content-aware image resizer - ▶️ ️Demo - ✏️ How it works - 📄 Seam carving paper by Shai Avidan and Ariel Shamir Background image by Ian Dooley Content-aware image resizing Content-aware image resizing might be applied when it comes to changing the image proportions (i.e. reducing the width while keeping the height) and when losing some parts of the image is not desirable. Doing the straightforward image scaling in this case would distort the objects in it. To preserve the proportions of the object while changing the image proportions we may use the Seam Carving algorithm. In the example below, you may see how the original image width was reduced by 50% using content-aware resizing (left image) and straightforward scaling (right image). In this particular case, the left image looks more natural since the proportions of the balloons were preserved. The Seam Carving algorithm’s idea is to find the seam (continuous sequence of pixels) with the lowest contribution to the image content and then carve (remove) it. This process repeats over and over again until we get the required image width or height. In the example below, you may see that the hot air balloon pixels contribute more to the content of the image than the sky pixels. Thus, the sky pixels are being removed first. Btw, finding the seam with the lowest energy is a pretty computationally expensive task (especially for large images). To make the seam search faster the dynamic programming approach might be a","default_branch":null,"files":null,"tree":[],"storefront":"/r/trekhleb","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/trekhleb/js-image-carver/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}