added some code that saves a copy of the image when a key on the keyboard is pressed.