Refacotred image resize.