remove unused images and optimize new ones