Dynamic programming
Seam carving
Make an image narrower by removing low-energy paths through it, with painted masks to protect the parts that matter.
Try it
Runs locally in your browser. Uploaded images stay on your device.
Paint on the source to protect a subject or mark an area for removal. Green protects; coral attracts seams. Keyboard: focus the source and use arrows to move and paint.


Ready when you are.
Worker processing · local inputs · downloadable output
How it works
Paint on the source to protect a subject or mark an area for removal. Green protects; coral attracts seams. Keyboard: focus the source and use arrows to move and paint.
- Measure local image gradients to build an energy map.
- Use dynamic programming to find the lowest-energy connected top-to-bottom seam.
- Remove it, update the image and masks, then find the next seam.
Read the original research
Shai Avidan & Ariel Shamir · 2007
Computed examples
Outputs from the same implementation used in the playground.


Source photographs were generated for these studies. The displayed results were computed by the algorithms; they are not generated illustrations of an expected result. Published previews are compressed for the web.
Implementation and limits
Uses backward gradient energy and removes vertical seams. Large changes can bend straight lines or distort faces; a protection mask cannot guarantee an undistorted result.
Interactive settings are bounded to keep the experiment practical in a browser. Higher detail can cost more processing time without guaranteeing a better result. The implementation and its tests are available in the source repository.
Protect and remove brushes affect the seam cost. Masks shrink with the image after every removal. If a protected region blocks every possible seam, some protected pixels must still be removed.