Grow Your Own Picture Genetic Algorithms & Generative Art

Evolving the Mona Lisa

Welcome! Click start to see genetics in action, as a randomly generated collection of shapes evolve to resemble a given picture.
How it Works
This page uses a genetic algorithm to model a population of individuals, each containing a string of DNA which can be visualised in the form of an image. By starting with a population consisting of a randomly generated gene pool, each individual is compared against the reference image (the one on the left), and the individuals can then be ranked by their likeness to it, known as their "fitness", with the best fit being displayed on the output image (the one on the right). By breeding the fittest individuals from the population, the DNA which produces the most accurate representation of the reference image is selected over successive generations, effectively demonstrating the power of a natural selection process to produce the best candidate for any given environment.
Source Code
As with all good things in life, this was created for fun, free, and science. The full source code for this site is available on GitHub and is released under the terms of the MIT License. If you just want to see how the genetics algorithm works, you can see the JavaScript implementation here.
Bugs and comments
I would love to know what you think. Don't be afraid of getting in touch with any thoughts and suggestions. If you would like to be a little more involved in the process, feel free to fork the source code repository and submit a pull request.
The code is my own, the idea is not. Full credit goes to Roger Alsing for the idea of using genetic algorithms to approximate fine art. Further thanks to Jacob Seidelin for writing a JavaScript implementation that inspired me to create this.
Population Size
Selection Cutoff
Mutation Chance
Mutation Amount
Random Inheritance
Difference squared
Fittest survive
Internal Resolution
Number of polygons
Number of vertices
Fill polygons
Real Time Analysis
Elapsed time
Number of generations
Average time per generation
Average time per improvement
Current fitness
Highest fitness
Lowest fitness

You can save your current settings to a URL for bookmarking, sharing and future reference.

Save image to file

Press 'Export to PNG' to render the current strongest individual as an image. You can save this image file to your hard disk.