Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Reconstruct any image using primitive shapes, runs in-browser via WASM (github.com/taiseiue)
42 points by taiseiue 1 day ago | hide | past | favorite | 8 comments
I built a browser-based port of fogleman/primitive — a Go CLI tool that approximates images using primitive shapes (triangles, ellipses, beziers, etc.) via a hill-climbing algorithm. The original tool requires building from source and running from the terminal, which isn't exactly accessible. I compiled the core logic to WebAssembly so anyone can drop an image and watch it get reconstructed shape by shape, entirely client-side with no server involved.

Demo: https://primitive-playground.taiseiue.jp/ Source: https://github.com/taiseiue/primitive-playground

Curious if anyone has ideas for shapes or features worth adding.

 help



Autotrace [0] is in a similar space. It's list of output formats mean its fairly entrenched into this incredibly niche space (along with Inkscape).

For a lot of people, tools like this are only part of the journey of what they're doing. So how you hand off the file to keep editing will matter.

[0] https://linux.die.net/man/1/autotrace


Some feedback that's hopefully helpful, would be great to add to the readme:

What would you say the primary purpose of this tool is? (not that a project needs a purpose beyond "because it was fun" or "just to learn" or even "because I could", but wondering). I have many times wished for a png to svg converter for various reasons (size, hackability, animate-ability) but I struggle to understand why you'd want to go from png to png with this (like in the demo image). I could very well be missing something though. The readme doesn't mention svg at all, though the linked inspiration project does so I assume that's a possible use case?


This page is a little older, but it offers the same kind of service and allows you to save in svg format : https://www.samcodes.co.uk/project/geometrize-haxe-web/

Thank you for your feedback! Outputting to SVG is indeed a useful feature. We will definitely implement it!

Not the guy who made it but I immediately wondered if I could use the intermediate steps with some "outline" mode to help me see things in shapes and finally learn to draw a bit.

I tried something similar once: https://www.youtube.com/shorts/750j6ssn5lw But it uses triangles only.

Neat!

Pristine theatrics, man.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: