improve resize function when enlarge a image