Berry van Someren
Software Engineer

Drarwing: Darwinian Drawing

2022

We use the principles of reproduction, mutation and survival of the fittest to evolve beautiful images. Drarwing Paint Brush can use different brush sets to produce outputs in different styles. The code can be found on GitHub.

(This image might load slowly) This GIF shows how Drarwing simulates a painting process, working from large and rough shapes, iteratively adding more detail.

The Painting Journey

My experiments in generating paintings algorithmically have known several shapes.
For further reading, please refer to the related blog posts:

  • Drarwing Paint Brush: A Genetic Algorithm to generate paintings.
    • You are reading this page now. Scroll down further to find out more.
  • Drarwing Pointillism: Drarwing used to generate paintings in pointillist style.
  • Drarwing Web: An optimized GCP hosted version of Drarwing for everyone to play with online.
  • Splart: Generating paintings using Differentiable Rendering, inspired by 3D Gaussian Splatting.

Gallery

Some examples of results. All original images are from unsplash.com

These images are 4K so make sure to click them to open them at full size!

Evolution of Images

Darwin defined evolution as "descent with modification". DNA defines a specimens properties. Specimen whose properties better fit their environment produce more offspring. Offspring receives a mix of genes from its parents, and differs even further through mutations in their DNA.

We can use a similar process to achieve arbitrary goals as long as we modify our definitions of these three rules appropriately. In this project "fitness" simply measures how well an image approximates a target image. The DNA of our image defines what brush strokes to make on a canvas to paint the image. Every mutation could add a brush stroke to our image, or change the properties of an already existing brush stroke.

Tricks I have used to speed up convergence of this Painting algorithm, and improve looks include; using the differences with the target image to further guide the area of mutation, using the magnitude of the overall differences to scale modifications, and using the gradient of the target image to guide the direction of brush strokes. However, instead of optimizing perfectly, we embrace the random number generator, and allow it to select suboptimal modifications in order to achieve a more artsy effect.

Making Virtual Art Physical

My former colleague Jayke Meijer modified Drarwing to continuously paint photos over eachother on an LCD inside a pictureframe. First it will paint one photo, and when it's done paint the next photo over it. He also sped up the process so that the painting is happening in real time. He built a custom pictureframe including an LCD screen and Raspberry Pi to show the continuously changing painting, and hung it in his house! He wrote this blog post on modifying Drarwing, and this blog post on building the pictureframe. Please check it out. It's a very cool project!