// the find
trekhleb/js-image-carver
🌅 Content-aware image resizer and object remover based on Seam Carving algorithm
A browser-based implementation of the Seam Carving algorithm for content-aware image resizing and object removal. You draw a mask over what you want gone, and the algorithm carves it out by repeatedly removing the lowest-energy pixel seams. Educational tool first, practical tool second.
The algorithm implementation is clean TypeScript with a simplified version alongside the full one, making it easy to follow the logic. The energy map visualization is a genuinely useful debugging aid — you can see exactly why the algorithm makes the cuts it does. The README is honest about failure cases (Van Gogh example), which is rare. The accompanying blog post explains dynamic programming optimization rather than hiding it.
Everything runs on the main thread — resize a large image and the browser locks up. No Web Worker offloading, no progress cancellation. Only downscaling is implemented; the plans section lists upscaling as future work but that was written in 2021 and hasn't moved. No way to export with transparency or non-JPEG formats — you get what the canvas gives you. The craco-based CRA setup is effectively dead infrastructure at this point.