Optimize images and delete unused images