Turn a photograph into a minimalist geometric art poster to print or share on social media.
Generate an animated GIF that shows a photo being reconstructed shape by shape for a satisfying visual effect.
Create scalable SVG artwork from photos that can be resized to any dimension without quality loss.
Produce a geometric wallpaper or avatar from a portrait photo using a specific shape type and color palette.
GIF output requires ImageMagick installed separately, use small input images around 256x256 pixels for fast results.
Primitive is a program that recreates a photograph using simple geometric shapes: triangles, rectangles, ellipses, circles, and similar forms. You give it an image file, tell it how many shapes to use, and it builds up an approximation of that image one shape at a time. The result looks like an abstract, stylized version of the original photo. The algorithm works by trying random shapes and measuring how much each one reduces the visual difference between the current drawing and the target photo. It keeps improving each shape through small random adjustments, keeping changes that make it closer and discarding ones that make it worse. This is repeated for every shape added. With around 50 shapes the result is recognizable but highly abstract. With 200 shapes it is much closer to the original while still looking painted or geometric. You run it from the command line. After installing Go and fetching the package, the basic command takes an input image, an output filename, and the number of shapes. You can also choose the shape type: triangles by default, but rectangles, ellipses, circles, rotated variants, or a mix are all options. The output can be a PNG or JPG file, an SVG vector graphic, or an animated GIF that shows each shape being added in sequence. For the GIF output, ImageMagick needs to be installed separately. The README recommends using small input images, around 256 by 256 pixels, because smaller files make the algorithm faster without affecting quality much since fine detail gets averaged away anyway. There is also a native macOS application available at primitive.lol if you prefer a graphical interface over the command line. The project is written in Go and the code is open source.
← fogleman on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.