optimize size of image used