Generative Art With R

Author

J.D. Dato

Example Work of My Generative Art:

All of the below images were made entirely in R using the generativeart R Package which is available on GitHub.

“The Path to Hell” (2023)

“Cyan Swirls” (2023)

How did I do this?

I have to be honest, I relied very much on the provided documentation of the package and ChatGPT to start working. Cyan Swirls was made using the boilerplate code provided in the documentation of the program.

The first image, which I have titled, The Path to Hell, was made entirely by me. I used a large uniform distribution to run some simple equations in, and set the output colors to red and black in a Polar grid.

The Code for The Path to Hell:

# This is my first take on generative art in R
devtools::install_github("cutterkom/generativeart")

library(generativeart)

# This is how the documentation says to run the program

library(generativeart)

# set the paths
IMG_DIR <- "img/"
IMG_SUBDIR <- "everything/"
IMG_SUBDIR2 <- "handpicked/"
IMG_PATH <- paste0(IMG_DIR, IMG_SUBDIR)

LOGFILE_DIR <- "logfile/"
LOGFILE <- "logfile.csv"
LOGFILE_PATH <- paste0(LOGFILE_DIR, LOGFILE)

# create the directory structure
generativeart::setup_directories(IMG_DIR, IMG_SUBDIR, IMG_SUBDIR2, LOGFILE_DIR)

my_formula <- list(
  x = quote(runif(100,-100,100) * x_i^sin(x)),
  y = quote(runif(100,-100,100) * y_i*cos(y))
)


generativeart::generate_img(formula = my_formula,
                            nr_of_img = 5, polar = TRUE,
                            color = "red", background_color = "black")