Yesterday I had an idea: what kind of art could I make by using random numbers and a series of rules? I decided to write down a few notes on what my "rules" would be. What colours could be used? How would colours be chosen? Could colours change? Then, I implemented all of my rules in Python. At first, I tried implementing them in Lisp, but this proved to be a bit too difficult given my limited experience with the language. Python was a lot easier to use, especially because I planned to turn my colours into an image.
I settled upon a few rules:
- There is a 1 in 200 chance a pixel turns black.
- There is a 1 in 3 chance the R (out of RGB) turns to 0.
- There is a 1 in 30 chance the G turns to 0.
- There is a 1 in 50 chance the B turns to 0.
- If none of the above rules are executed, the next pixel will be equal to the R, G, B value of the last pixel minus 10 for each value.
When I first wrote these rules, I didn't really know what to expect. I had a few ideas but was not prepared for the art I generated. After a bit of coding -- and a lot of testing to see what patterns I liked the most -- I ended up with the image that is at the top of this blog post.
These rules are executed 262144 times. One for each pixel in a 512x512 image. Then, I used the PIL Python library to turn my list of RGB values into a real image. I rotated the image 90 degrees after some testing so that my picture would look like colours were falling from the top.
The image is not particularly special but I find it mesmerising.
Have you done any experiments with computer-generated art? If so, feel free to email me at firstname.lastname@example.org and tell me about what you have made.
Respond to this post by sending a Webmention.