Live data from Hacker News

The algorithm for a perfectly balanced photo gallery

crispymtn.com

21–30 of 104 posts

Re: The algorithm for a perfectly balanced photo gallery

#21

What's just as impressive is the full size view of the image. The background brings the ambient colour of the photo to make it more immersive. Very nice!

I agree, that looks very nice. I might be wrong here but I think the background is just the picture, although scaled and has got many filters on it.

That's an idea I've actually seen done but executed poorly many times.

What they got right this time is adding the shadow around the image making it easy to distinguish from the background, and blurring it so heavily that none of the detail is distracting.

Very nicely done.

Re: The algorithm for a perfectly balanced photo gallery

#22

I just implemented pretty much the same thing from scratch for my wedding gallery¹. For each row, it tries 3-10 images, sums their aspect ratios, divides the total row width by the sum to get a candidate height, then picks the height that's closest to the average of the existing rows. To make things look a bit nicer, it rejects candidate rows with the same number of images as the last row. I might release the code on…

I end up with some of the photos ending up behind other photos. Firefox 23 here.

Re: The algorithm for a perfectly balanced photo gallery

#26

I just implemented pretty much the same thing from scratch for my wedding gallery¹. For each row, it tries 3-10 images, sums their aspect ratios, divides the total row width by the sum to get a candidate height, then picks the height that's closest to the average of the existing rows. To make things look a bit nicer, it rejects candidate rows with the same number of images as the last row. I might release the code on…

I end up with some of the photos ending up behind other photos. Firefox 23 here.

Me too, Chrome 28.0.15

Re: The algorithm for a perfectly balanced photo gallery

#27
It like how it looks, but much like Flickr I dislike how it's biased towards landscape pictures. Some of my best photos are portrait, but they get overshadowed by the landscape ones.

I imagine the algorithm to cater to both is much harder, because you wouldn't be able to treat each row in isolation, can it actually be solved to a good standard?

Re: The algorithm for a perfectly balanced photo gallery

#28

I just implemented pretty much the same thing from scratch for my wedding gallery¹. For each row, it tries 3-10 images, sums their aspect ratios, divides the total row width by the sum to get a candidate height, then picks the height that's closest to the average of the existing rows. To make things look a bit nicer, it rejects candidate rows with the same number of images as the last row. I might release the code on…

For me it displayed white rectangles initially - but disabling Adblock extension on Chrome worked (looks great).

However if you then resize the window it seems to make all the images disappear (?)

Post reply on HN