Hi all, this is my first post in the forums, so please tell me if I'm in the wrong place for this.
Anyway, after asking the user to upload in image at the beginning of the program, the program then does some manipulation and such, but afterwards when I try to select the image just from windows explorer, or upload it again into the program it says the file is empty.
The code is:
PImage userImage;
void setup() {
String loadPath = selectInput("Choose a .jpg, .gif or .png file to upload");
if (loadPath == null) {
println("No file was selected.");
} else {
println(loadPath);
userImage = loadImage(loadPath);
}
createOutput(loadPath);
if (userImage.width > 1000 || userImage.height > 1000) {
userImage.width = userImage.width/2;
userImage.height = userImage.height/2;
}
size(userImage.width, userImage.height);
background(0);
}
void draw() {
noStroke();
smooth();
color pixColor;
int siz = (userImage.width/5);
//this just makes a little colour scheme based on the image
for(int x = siz/2; x < userImage.width; x +=siz) {
for(int y = siz/2; y < userImage.height; y +=siz){
pixColor = userImage.get(x, y);
fill(pixColor);
ellipse(x, y, siz, siz);
}
}
}
Basically the file just disappears, and a placeholder icon is in it's place. Has this happened to anyone else before?
Anyway, after asking the user to upload in image at the beginning of the program, the program then does some manipulation and such, but afterwards when I try to select the image just from windows explorer, or upload it again into the program it says the file is empty.
The code is:
PImage userImage;
void setup() {
String loadPath = selectInput("Choose a .jpg, .gif or .png file to upload");
if (loadPath == null) {
println("No file was selected.");
} else {
println(loadPath);
userImage = loadImage(loadPath);
}
createOutput(loadPath);
if (userImage.width > 1000 || userImage.height > 1000) {
userImage.width = userImage.width/2;
userImage.height = userImage.height/2;
}
size(userImage.width, userImage.height);
background(0);
}
void draw() {
noStroke();
smooth();
color pixColor;
int siz = (userImage.width/5);
//this just makes a little colour scheme based on the image
for(int x = siz/2; x < userImage.width; x +=siz) {
for(int y = siz/2; y < userImage.height; y +=siz){
pixColor = userImage.get(x, y);
fill(pixColor);
ellipse(x, y, siz, siz);
}
}
}
Basically the file just disappears, and a placeholder icon is in it's place. Has this happened to anyone else before?
1