add a way to compress image avoiding OOM