base64 encode image data.