Live data from Hacker News

Content-aware image resize library

github.com

21–30 of 84 posts

Re: Content-aware image resize library

#21
post #20

Seam carving is cool and has a lot of potential, especially for certain kinds of images. I can't wait until we see something like it in pro photo editors like Affinity Photo.

Photoshop has it for ages; even bought the original research.

Re: Content-aware image resize library

#22

Seam carving is fascinating, and especially the first version of the algorithm really really simple to implement. However, that algorithm introduces certain artefacts - the boat in this picture[0] makes it pretty obvious. The cause of these artefacts are mainly that the original algorithm did not look at energy that was introduced by removing a seam: each time this happens, the pixels adjacent to this seam become nei…

Seam carving is also slow and doesn't work well for stretching images beyond around 50%. Moreover, computing optimal sequence of carving steps using dynamic programming for large images is not practical.

Re: Content-aware image resize library

#25
post #6

Could we use any direction for pixel removal, rather than only vertical or horizontal ?

You either shrink picture horizontally by one pixel or vertically by one pixel; seams must be 8-connected and always advance by 1 pixel in the opposite direction to the one being removed. It's a heuristics and by making it that way you can guarantee exactness of 1px removal.

These days it's a popular algorithm to be implemented as a midterm project in computational photography courses at top schools.

Re: Content-aware image resize library

#26
I wrote a GUI for another seam carving library back in 2009[1], and it looks like although in archive mode, you can still access the source as well as the windows / mac binaries. Just tested it and it still works!

Not as fancy as photoshop I'm sure, but does have the ability to paint a mask of regions to keep / remove to aid the algorithm and get the desired result. Multi-threaded too!

[1] https://code.google.com/archive/p/seam-carving-gui/

Re: Content-aware image resize library

#29
post #7
post #2

Looks really interesting. I'd love to see an animated version that shrinks from large to small.

I wrote a version of this in javascript with a live demo you can play with at https://alexander.soto.io/seam-carving

Unable to resize on mobile. Consider giving some margin or padding on the right of the image so one can drag the line to resize.
Post reply on HN