Optimizing the size of the image