optimize images and specify image dimession.