News for hackers. Stuff that matters.
Re:How Math Helped Me Write Less Code and Made Our App Faster by noelwelsh on Wednesday February 12, 2014 @04:03AM (#7223275)
Interesting write-up. I'm assuming there is a fixed number of images to fit into the layout which makes the problem a lot easier. Otherwise a bin-packing approach might be warranted.

Somewhat related, I came across an interesting method to resize images called "seam carving". It uses a dynamic programming approach to remove rows or columns that seem uninteresting. The end result is that the important parts of the image are retained when the image is resized. The wikipedia page is fairly good: http://en.wikipedia.org/wiki/Seam_carving There are nice demos on Youtube as well: http://www.youtube.com/watch?v=6NcIJXTlugc Now imagine doing this on the front-end (might be possible now in real-time) and the layouts this would allow!

Re:How Math Helped Me Write Less Code and Made Our App Faster by eru on Wednesday February 12, 2014 @04:32AM (#7223372)
> Now imagine doing this on the front-end

Like, in the browser?

Re:How Math Helped Me Write Less Code and Made Our App Faster by noelwelsh on Wednesday February 12, 2014 @06:38AM (#7223774)
I can't tell if you're being sarcastic or not, so I'll give you the benefit of the doubt.

Yes I mean in the browser. The convolution (edge-detection) is definitely possible in WebGL, and the dynamic programming algorithm probably is, so you could probably get sufficient performance in the browser to do this on multiple images in real time.

Re:How Math Helped Me Write Less Code and Made Our App Faster by eru on Wednesday February 12, 2014 @08:14PM (#7228701)
Not sarcastic. I just didn't know whether you meant the browser or eg the last layer of, say, PHP before it leaves the server.