Added functionality to save image as .jpg, .bmp or .png