How to open and display an image via open dialog box

Anyone know how? Various Google searches, and I haven't found anything other than the code below. I just want to be able to select a .png file to be loaded into a PImage variable. Easy enough if you want to open a specific image, but I want the user to be able to open what image they want from a folder of images.

void fileSelected(File selection) { if (selection == null) { println("Window was closed or the user hit cancel."); } else { println("User selected " + selection.getName()); } }

void setup() { selectInput("Select a file to process:", "fileSelected"); }

Tagged:

Answers

Sign In or Register to comment.