scale image by ratio