optimize the image storage