image compression and cleaning