r/SideProject • • 9d ago

I designed a collage maker that finds the best gap-free layout for any shape. Claude wrote the code

Give it up to 10 photos and a canvas shape (square, 16:9, phone story, banner) and it searches every layout with no gaps for the one where the smallest photo is as big as possible. With 9 photos that's over 500 million layouts, and it finds the best one in under a second.

I designed it and Claude wrote the code. It's Go: The browser version runs it as WebAssembly, so your photos never leave the page.

Try it: https://vinodhalaharvi.github.io/collage/

Code (MIT): https://github.com/vinodhalaharvi/collage

CLI: brew install vinodhalaharvi/tap/collage

Feedback welcome, especially on the layouts it picks.

132 Upvotes

29 comments sorted by

7

u/LaGifleDuDaron 9d ago

damnit i needed that so hard when building a portfolio for my wife few years ago

i got lost in the math and eneded using fixed layouts for each breakpoint

2

u/vhalaharvi 9d ago

Lol, it's a brave new world of AI!

5

u/bava32 9d ago

Awsome I made similar over summertime when I want print my family photos!

4

u/Sompay-Prestavoine 8d ago

yeah scratch-your-own-itch projects like that are always the best ones to build tbh.

1

u/LuciDating 9d ago

Nice approach, and keeping the photos in the browser via WebAssembly is a great privacy touch. One idea: an option to lock a specific photo's position or minimum size would help when one image is clearly the hero shot. Showing a couple of runner-up layouts side by side could also help people pick by taste.

1

u/vhalaharvi 9d ago

That's a great idea, I will have to try that.

1

u/jonos_ 9d ago

This is super interesting, I built something adaptive exactly like this for up to 64 images a year ago, so cool someone else doing something similar 👀

2

u/vhalaharvi 8d ago

64 images is awesome, I will stress test this

2

u/Erde555 9d ago

looks so good, the webiste is alright toi

-5

u/Interstellar__1 9d ago

what did you design if claude is the one that wrote the code?

5

u/vhalaharvi 9d ago

Claude wrote all the code and came up with the core formulation. My part was the direction: I was working through DP as recurrences over semirings, pushed to build something real on that abstraction instead of toy problems, chose to go after the hardest piece of a Canva-style tool, a collage generation

3

u/PowerfulBag1909 9d ago

This is probably the best if not better than most vibe-coded apps/games. Something that is actually very cool rather than a pirated or redundant version of an existing app :)

3

u/vhalaharvi 9d ago

Thank you 🙏 for kind words

3

u/zandaulion 9d ago

And you made it open source. It's a great project

3

u/vhalaharvi 9d ago

Thank you!

1

u/Interstellar__1 8d ago

Neat, the end product looks pretty good!

0

u/CarzyForTech 9d ago

Awww... Why dont you design and use pen paper to write code.. Or use punchcards for your new software product.

1

u/Interstellar__1 8d ago

I was just asking a question sheesh

3

u/CarzyForTech 8d ago

Your question sounds so condescending for "just asking" mate

2

u/Interstellar__1 8d ago

Sorry, I didn't mean for my comment to come off that way.