implements sprite compressing method