ImagePicker base64 becomes really large on Android

We let users upload photo’s by selecting them with the ImagePicker. When they submit it, the base64 output is sent to our API. Our API accepts a maximum size of 8mb and we noticed that on Android devices a lot of times this maximum size is exceeded.

I just did a test with a small image and saw that the base64 result of ImagePicker (image of 41kb) becomes 13kb for iOs and 79kb for Android. So the base64 version is almost double the size of the original on Android.

What is causing this? We just use the code as provided by the Expo example.

const result = await ImagePicker.launchImageLibraryAsync({
  mediaTypes: ImagePicker.MediaTypeOptions.Images,
  exif: true,
  base64: true
})

if (!result.cancelled) {
  result.uploading = false
  result.error = false
  console.log(result.base64)
}

Hey @oneshoe,

Can you provide some additional information such as what SDK you are running, if this happens on all android devices, if not which devices are affected?

Cheers,

Adam

This happens in production on SDK27 but I also noticed it in our dev env with SDK28.
I tested it on a Google Pixel 8.0 - API 26 simulator and our client noticed it with several Android devices (so I think this happens on all or most of them).

Our client experienced it on the following devices: Sony Xperia Z5 Compact, Nexus 6P and Samsung A3.
On the Nexus 6P 300 kB became 760kB for e.g.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.