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)
}