Hi, I am new in Processing and I have this project that someone has to make an image selection then the selection has to be saved in a specific folder so that when the archive is running again that can save the new selection into a new folder.
Actually, my project has 17 images to be load and chosen by the user but I have put here only 7 so could be easier to view. Someone has a tip what should I do? Should I remake the saving code below?
PImage [] fotos = new PImage[7];
int index = 0;
Names[] name = new Names[fotos.length];
void setup() {
size (400,400);
background(0);
fotos[0] = loadImage("carta0.png");
fotos[1] = loadImage("carta1.png");
fotos[2] = loadImage("carta2.png");
fotos[3] = loadImage("carta3.png");
fotos[4] = loadImage("carta4.png");
fotos[5] = loadImage("carta5.png");
fotos[6] = loadImage("carta6.png");
for (int i = 0; i < fotos.length; i++) {
name[i] = new Names(fotos[i]);
}
}
void draw() {
}
void mousePressed() {
background(0);
index = int(random(0, fotos.length));
name[index].display();
println(index);
}
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
save("print0.png");
} else if (keyCode == DOWN) {
save("print1.png");
} else if (keyCode == LEFT) {
save("print2.png");
}
else if (keyCode == RIGHT) {
save("print3.png");
}
}
}
class Names{
PImage img;
Names(PImage tempImg){
img = tempImg;
}
void display(){
stroke(0);
imageMode(CENTER);
image(img,width/2,height/2);
}
}