library
library copied to clipboard
decodeFromImage not working
Bug Description
BrowserMultiFormatReader.decodeFromImage
and BrowserQRCodeReader.decodeFromImage
not working.
To Reproduce Steps to reproduce the behavior:
- Go to https://zxing-js.github.io/library/examples/multi-image/
- Click on
DECODE
button. - See the error.
Expected behavior Detecting the qr code on the image
Screenshots
Desktop
- OS: MacOS
- Browser: Chrome
- Version: latest
Additional context I also wrote my own code to test
<html>
<head>
<title>ZXing Canvas Test</title>
</head>
<body>
<img src="https://blog.hubspot.com/hs-fs/hub/53/file-2457427390-jpg/00-Blog_Thinkstock_Images/qr-code.jpg?width=381&name=qr-code.jpg" />
<script src="https://unpkg.com/@zxing/library@latest"></script>
<script>
const { BrowserQRCodeReader } = ZXing;
const reader = new BrowserQRCodeReader();
(async () => {
try {
const img = document.querySelector("img");
const results = await reader.decodeFromImage(img);
console.log(results);
} catch (err) {
console.log(err);
}
})();
</script>
</body>
</html>
I was able to replicate this. It's also true for Data Matrix decodes.
this.$el.innerHTML += <img id="image" src="qr.png"/>
;
const img = document.getElementById('image');
img.videoWidth = 0;
For my solution !
Stale issue message