Skip to content Skip to sidebar Skip to footer

Imagefile(path, Uri) To Base64 Encoded String Has Problem In Kotlin

I tried to capture camera preview in android device and encode imagefiles to Base64 String. I've already tested like this // Convert Failed to Image private fun encoder1(filePa

Solution 1:

You should add the header like this [data:image/png;base64,]

You can try the image covert to base64 online

https://www.base64-image.de/

Check the base64 image data format

Solution 2:

If you log the base64 string to logcat then only the first bytes of the string are printed.

So copy/paste will only give you part of the base64 string.

Post a Comment for "Imagefile(path, Uri) To Base64 Encoded String Has Problem In Kotlin"