Resize image to original dimensions when dialog is closed