Using threads in processing to save images and display them on screen