zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.

Home Page:https://zxing-js.github.io/library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

repeat decode report "Readers were able to detect the code"

RelicOfTesla opened this issue · comments

Describe the bug
repeat decode report error.

To Reproduce
Steps to reproduce the behavior:

  1. select a qrcode image file, like a url qrcode-image
  2. open chrome developer console, and click xx button
  3. See error or See good qrcode result
  4. repeat click xx button again and again .

Screenshots

N: No MultiFormat Readers were able to detect the code.
    at cr.decodeInternal (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:258268)
    at cr.decodeWithState (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:257320)
    at t.BrowserMultiFormatReader.decodeBitmap (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:331917)
    at t.BrowserMultiFormatReader.decode (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35508)
    at n (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:34933)
    at /unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35104
    at new Promise (<anonymous>)
    at t.BrowserMultiFormatReader.decodeOnce (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35084)
    at HTMLImageElement.imageLoadedListener (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:33775)
Promise.catch (async)
(anonymous) @ err.html:26
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
err.html:21 blob:null/906896c9-a98d-4257-980e-b0d6e8e46de7
v {text: 'a', rawBytes: Uint8Array(9), numBits: 72, resultPoints: Array(3), format: 11, …}
err.html:21 blob:null/906896c9-a98d-4257-980e-b0d6e8e46de7
N: No MultiFormat Readers were able to detect the code.
    at cr.decodeInternal (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:258268)
    at cr.decodeWithState (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:257320)
    at t.BrowserMultiFormatReader.decodeBitmap (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:331917)
    at t.BrowserMultiFormatReader.decode (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35508)
    at n (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:34933)
    at /unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35104
    at new Promise (<anonymous>)
    at t.BrowserMultiFormatReader.decodeOnce (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:35084)
    at HTMLImageElement.imageLoadedListener (/unpkg.com_@zxing_library@0.20.0_umd_index.min.js:1:33775)

Desktop (please complete the following information):

  • OS: win10
  • Browser chrome
  • Version 115.0.5790.171
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="unpkg.com_@zxing_library@0.20.0_umd_index.min.js"></script>


<input type="file" class='fp'>
<img class="img1"  />
<button type="button" class='btn'>xx</button>

<script>

    $('.fp').change(function(){
        var fp = $('.fp');
        var f=fp[0].files[0];
        let blobURL = URL.createObjectURL(f);
        console.log(blobURL);
        $('.img1').attr('src', blobURL).data('src', blobURL);
    });

    $('.btn').click(function(){
        let blobURL = $('.img1').attr('src');
        console.log(blobURL);
        let reader = new ZXing.BrowserMultiFormatReader();
        // reader.setHints(null);
        let r = reader.decodeFromImageUrl(blobURL);
        // let r = reader.decodeFromImage($('.img1')[0]);
        r.then(console.log).catch(console.error);
    })

</script>

<style>
    .img1{
        max-width: 400px;
    }
</style>

example qrcode, the value is "a"
qrcode5

it's work on v0.18.6, exception >= v.0.19

@RelicOfTesla Could this just be how you implemented the library? As I don't get have any issues with repeated scanning of the above QR code here:

https://barcode.leethost.com/

@teckel12, Decode from static image file, don't scan from camera.

@teckel12 I am also encountering the above issues now. Some IMG QR codes can be scanned, and some also report this error. IMG only has different width and height, is it due to the IMG ratio issue?

Stale issue message