How to get image data from Camera

#1

I am new on Expo and trying to get image data from takePictureAsync() function
but I am getting only uri when I call that function.
I saw Expo Camera document, but not sure how I can use base64 argument.

Object {
“height”: 1920,
“uri”: “file:///var/mobile/Containers/Data/Application/4E5695E9-31C1-4862-8787->
9251DFCF44B6/Library/Caches/ExponentExperienceData/%2540anonymous%252Ftest->c92b9374-1193-4655-a4fd-82b0bc231227/Camera/7C22A977-63E5-43EF-9B94->DB10D8828513.jpg”,
“width”: 1080,
}

here is codechip I did

this.camera.takePictureAsync().then((image64)=>{
console.log(image64)

please help me asap.

#2

you need to pass the base64 option to takePictureAsync to get the image data back as base64.
https://docs.expo.io/versions/latest/sdk/camera.html#base64-boolean--whether-to-also-include-the-image-data-in-base64-format

#3

yes, just solved it.
thanks for your reply.
one more another question.
can I send base64 data to google cloud vision api?

#4

yep.

here is an example of doing that.

1 Like