Convert image to base64 directly in to json file