Generative art · Genetic algorithms
Art through genetic algorithms
I taught a genetic algorithm to paint: it starts from chaos, mutates and crosses, generation after generation, until the picture resembles the original, whether a photo or a work of art.
01 — Gallery
Works
No works yet.
Put a folder in site/assets/works/ with final.png, evolution.gif and history.csv (the ones gapoly writes), plus original.jpg: it shows up here on the next publish.
02 — Method
From chaos to likeness
Every image starts from elements scattered at random. For thousands of generations the best ones are picked, tweaked and crossed, until the photograph resurfaces.
-
Selection
Among the candidate images, those closest to the photograph win in small tournaments.
-
Crossover
Sometimes two parents swap part of their elements; other times the child is a copy.
-
Mutation
Every child changes a little: an element moves, changes colour, a new one arrives or one disappears.
-
Repeat
The best ones move on to the next generation. The error drops, the photo emerges.
The error, generation after generation
How far the image is from the photo, pixel by pixel. It drops sharply in the first generations, then every improvement costs more and more: that is where the details emerge.
Drawing techniques
The same algorithm, different elements. Each leaves a recognisable mark on the photo.
03 — About