Finally! The proper resize function for overlay viewer.