compress image and erase unused image