implements feature of restoring img by resizing window.