react-native-camera icon indicating copy to clipboard operation
react-native-camera copied to clipboard

Is there any way to return an image in byte array format ?

Open paulobatista-dev opened this issue 9 years ago • 5 comments

I have a thermal printer and i need take pictures through this API. So to send the image to the printer i need to convert a base64 image to byte array. I have the base64 image information, is there any way to get a byte array to do it?

-- I can take pictures already

paulobatista-dev avatar Jul 17 '17 14:07 paulobatista-dev

@costabatista I'm just getting started with react-native-camera, and may be wrong, but this seems like it's not an issue specific to react-native-camera. I googled "convert base64 to byte array" and got this https://stackoverflow.com/questions/42360999/convert-base64-string-into-byte-array-through-javascript

Does that help?

hedgerh avatar Jul 18 '17 08:07 hedgerh

@hedgerh Unfortunately this approach doesn't solve this problem. It's because we can't use atob and btoa methods in react native in a release mode apk. I need put this base64 string obtained by react-native-camera in a byte array without any other dependencies. So, in react-native this approach is when we use debugger through chrome. :( i'm seeking the solution yet, but thanks for your help :) !

paulobatista-dev avatar Jul 18 '17 17:07 paulobatista-dev

@hedgerh So now, i'll use something like this solution.... i'll search about a way to replace atob method. Thanks :)

paulobatista-dev avatar Jul 18 '17 17:07 paulobatista-dev

try this: https://github.com/beatgammit/base64-js

ryanwaite28 avatar Oct 21 '17 18:10 ryanwaite28

Closed since it sees like @ryanwaite28 answered the question. Please reopen if this issue is still not solved.

n1ru4l avatar Sep 24 '18 21:09 n1ru4l