Skip to content

Primitive

Recreates an image using a set number of simple geometric shapes, one at a time.

Stars
13.6k
Forks
672
Licence
MIT
Language
Go
Last update
2.3 years ago
Type
CLI

No commits in over a year — check for forks or alternatives before adopting.

What it is

Primitive takes a picture and rebuilds it from simple shapes such as triangles, ellipses, and rectangles. It adds one shape at a time, each chosen to reduce the difference between the result and the original, so the output looks abstract and artistic. It runs as a command-line tool written in Go, and the README also mentions a native macOS app.

  • Turn a photo into a PNG or JPG made of 50 to 200 shapes
  • Export the result as an SVG vector file
  • Create an animated GIF showing shapes being added (requires ImageMagick)
  • Run the same image several times to get different abstract versions

Great for

  • Artists exploring generative or abstract image styles
  • Developers who want a Go example of image optimization with hill climbing
  • People who want to turn photos into vector SVG art
  • Students learning how simple shapes can approximate an image

Not ideal for

  • Anyone needing exact photo reproduction, since the README describes a stylized approximation
  • Users who want a point-and-click tool without a terminal, unless they use the macOS app, which the README does not detail
  • Very large images, since the README recommends small inputs (around 256x256px) for speed
Step-by-step guide: how to use PrimitiveInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Go (install from golang.org)

    Install primitive with Go

    go get -u github.com/fogleman/primitive
  2. 2

    Run it

    • Install Go using the link in the README
    • Run the install command
    • Run: primitive -i input.png -o output.png -n 100
    • Open output.png to see the result
  3. 3

    Get the most out of it

    • Use -m to pick a shape mode, such as 1 for triangles or 3 for ellipses
    • Save multiple outputs at once by using -o more than once, for example PNG and SVG
    • Use a %d pattern in the output filename to save each frame separately
    • Use -r to set a smaller resize size for faster runs on large images

Downloads

Strengths

  • Simple idea that produces distinctive, recognizable art
  • Supports several shape types and multiple output formats including SVG
  • Permissively licensed under MIT

Trade-offs

  • Output is an artistic approximation, not a faithful copy
  • Large inputs run slowly; the README advises resizing to small images
  • README does not document the macOS app's features or requirements

How it compares

ProjectStarsTypeLevelUpdatedBest for
primitive (this)13.6kCLIintermediate2.3 years agoArtists exploring generative or abstract image styles
Pixelorama10.9kAppbeginner4 days agoPixel artists making sprites or tiles for games
renderdoc11.3kAppintermediate6 days agoGraphics programmers debugging their own Vulkan, D3D11, D3D12, or OpenGL applications
iced31.9kLibraryintermediate4 days agoRust developers building a desktop GUI application
magictools17.7kCurated listbeginner5 days agoIndie game developers looking for sprites, textures, icons, or 3D models
DearPyGui15.7kLibrarybeginner18 days agoPython developers who want a desktop GUI for a script or internal tool

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.