Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to send image in format Uint8ClampedArray #1225

Open
guyindepurker opened this issue Sep 1, 2021 · 0 comments
Open

how to send image in format Uint8ClampedArray #1225

guyindepurker opened this issue Sep 1, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@guyindepurker
Copy link

this is my code:
javascriptBarcodeReader({
/* Image file Path || {data: Uint8ClampedArray, width, height} || HTML5 Canvas ImageData */
image: {data: Uint8ClampedArray.from(res),width: 3333, height: 313},
barcode: 'code-128',
// barcodeType: 'industrial',
})
.then(code => {
console.log('code is',code)
})
.catch(err => {
console.log(err)
})

its print my nothing

my res is the result of base64 image with this:
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));

for(i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
return array;
}

@guyindepurker guyindepurker added the bug Something isn't working label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants