added saveImage method