Computer generated contemporary art
Posted on 05 February 2016
Just a quick selection of images randomly-generated by the following 10 lines or so of Python.
import sys
import numpy as np
from PIL import Image
try:
filename = sys.argv[1]
except IndexError:
filename = 'img.png'
rshift = 3
width, height = 600, 450
arr = np.ones((height, width, 3)) * 128
for y in range(1,height):
arr[y,0] = arr[y-1,0] + np.random.randint(-rshift, rshift+1, size=3)
for x in range(1, width):
for y in range(1,height-1):
arr[y,x] = ((arr[y-1, x-1] + arr[y,x-1] + arr[y+1,x-1])/3 +
np.random.randint(-rshift, rshift+1, size=3))
im = Image.fromarray(arr.astype(np.uint8)).convert('RGBA')
im.save(filename)