Scaling of images for optimization