improved the speed of image resizing