Seam Carving (Content-Aware Resize) illustration

Seam Carving (Content-Aware Resize)

Resizes an image by carving out low-energy seams — connected paths of pixels that run through the smoothest, least interesting parts of the picture — instead of scaling every pixel uniformly. The subject keeps its proportions while sky, water and walls give way. Watch the seams get removed one by one, inspect the energy map the algorithm is minimising, paint regions to protect or to erase entirely, and compare the result against a plain resize. Inserting seams stretches an image the same way.

Runs 100% in your browser — images never leave your device.

Notes

  • Energy is the gradient magnitude of the image: edges score high, flat areas score low. A seam is the eight-connected top-to-bottom (or left-to-right) path with the smallest total energy, found by dynamic programming; removing it shifts the rest of the row by one pixel.
  • Seam carving shines on landscapes and product shots with plain backgrounds. Faces, text and regular patterns have no low-energy path to spare, so distortions appear once you carve more than roughly a third of the width.
  • Large photos are worked on at a reduced size so the animation stays smooth; the download is that working size. Pick a bigger working size for a sharper result.
  • Everything runs locally in your browser; your images are never uploaded to any server.

Explore the idea

This interactive demo needs JavaScript.