Hi everybody,
I am currently working on a project where I have an image wall 5 x 5 grid.
The project selects and display random images from data folder after each iteration. I have hacked together a working demo over the last couple of days.
At the moment I am using 733 images, however, it is hoped that the project may draw from a selection of over 100,000 jpegs.
As I said, it works at the moment but can be quite ‘clunky’. When I change the framerate from 2 to 16, there is no difference.
I am assuming this is down to my ‘bad’ coding and am wondering if there is a better way for me to approach this project/code to make it more robust?
I am using a macbook pro at the moment, but I would love to have this project ultimately on rasp pi…possible wishful thinking on my part…anyway here is the code if anyone has any suggestions:
void setup() {
size(500, 500);
background(0);
frameRate(16);
};
void draw() {
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
while (i < 5) {
float a = random(0,733);
int ranNum = int(a);
PImage img;
img = loadImage("image" + ranNum + ".jpg");
img.resize(100,100);
image(img, (i * 100), 0);
i = i + 1;
}
while (j < 5) {
float a = random(0,733);
int ranNum = int(a);
PImage img;
img = loadImage("image" + ranNum + ".jpg");
img.resize(100,100);
image(img, (j * 100), 100);
j = j + 1;
}
while (k < 5) {
float a = random(0,733);
int ranNum = int(a);
PImage img;
img = loadImage("image" + ranNum + ".jpg");
img.resize(100,100);
image(img, (k * 100), 200);
k = k + 1;
}
while (l < 5) {
float a = random(0,733);
int ranNum = int(a);
PImage img;
img = loadImage("image" + ranNum + ".jpg");
img.resize(100,100);
image(img, (l * 100), 300);
l = l + 1;
}
while (m < 5) {
float a = random(0,733);
int ranNum = int(a);
PImage img;
img = loadImage("image" + ranNum + ".jpg");
img.resize(100,100);
image(img, (m * 100), 400);
m = m + 1;
println(ranNum + " " );
}
}