Random Art Generator
This project makes randomly generated
.png images. It creates an expression
for each color channel, which it then runs with the x and y coordinates of each image pixel to determine the pixel's final color.
What's an expression?
I'm super-glad you asked! It takes an
y value and returns a new
value between -1.0 and 1.0. It nests functions to create unexpected values.
This image was created with the following expression:
sin(pi * sin(pi * sin(pi * (sin(pi * sin(pi * sin(pi * sin(pi * cos(pi * y))))) * cos(pi * sin(pi * cos(pi * avg(sin(pi * y), (x * x)))))))))
You can look at
random_art.py and edit it in order to change the expression generation process.
How to run this
This project uses pipenv. To use it, download the project and run
pipenv run or after you run
create_art.py takes several command-line parameters you may want to use.
--seed SEEDsets the random seed to a particular number. This is great for being able to generate the same image more than once.
--size SIZEsets the size of the image.
--number NUMsets how many images to create.
NUMis 1 by default.
--cmykset whether the image is in grayscale or generated using RGB or CMYK values. RGB is the default.
Modified from a "nifty assignment" from the annual SIGCSE meeting.