hey thiezar, maybe the size function can be used only in setup function once in a program. I tried this which changes the image but somehow doesn't changes the window size. try this
PImage img;
void setup(){
pickImage();
}
void draw(){
// selectImage();
if(mousePressed == true){
pickImage();
}
}
void pickImage(){
String path=selectInput();
img=loadImage(path);
size(img.width,img.height);
image(img,0,0,width,height);
}