I am planning to add profile pictures to my social-app for musicians Riff and Match, and I would like to offer users a randomly generated abstract picture. I had a look around for existing solutions in python and couldn’t find anything to my liking, so I came up with a simple procedure that looks good enough to me and is modular enough to experiment in the future with new variations.
You can find the code and instructions on github - this post is meant as a more detailed explanation of how the procedure works.
The idea is to leverage the many beautiful colormaps available in matplotlib to avoid reinventing the wheel — these offer a convenient way to continuously map any number between 0 and 1 to a color belonging to a specific curve in color-space. It is then enough to vectorize the image along some random path (step 1) and map point k in the path to k/N (where N is the length of the path), coloring the corresponding pixel with the value of the chosen colormap for k/N.
I had several ideas in mind on how to find an interesting path (some of which I mention in the last section of this post), but to my delight the first try — the EPWT [1] applied to randomly generated mask — gave quite interesting results so I decided to publish it as-is and maybe down the line play with other variants.