image compression and cleanup