minimize empty img, use base64 in js.