Skip to content

πŸŒ… JS Image Carver

project
1.6K

Content-aware image resizer based on Seam Carving algorithm. Also performs objects removal

  • JavaScript
  • TypeScript
  • Algorithms
  • Seam Carving
  • Image Processing

About

JS Image Carver changes an image's proportions without distorting what's in it. Plain scaling squeezes everything, while content-aware resizing removes the least important pixels and keeps the main objects intact.

It implements the Seam Carving algorithm: find a seam, a connected path of pixels that contributes least to the picture, remove it, and repeat until the image reaches the target size. Dynamic programming keeps the search for the cheapest seam fast. The same technique can remove objects: mark an object and it's carved out while the rest of the image closes the gap.

Everything runs in the browser, and the accompanying article explains the algorithm step by step.

Achievements

9