aleris / zxing-typescript

Open-source, multi-format 1D/2D barcode image processing library ported from Java in TypeScript usable from node or browser
Apache License 2.0
80 stars 30 forks source link

Only works with example Image #3

Closed ishaqbhojani closed 7 years ago

ishaqbhojani commented 7 years ago

Hi there, I finally successfully installed with angular 4 and typescript. but its only decode the QR code you have provided in example.

Its not working with any other QR code.

I have tried following images.

1. download 2. code128 3. 22810301_813199782175429_385919422_o 4. dd

It only works with. qrcode-image

Here is my code.

onImageSelect(e) {
    const codeReader = new BrowserQRCodeReader();
    const myReader = new FileReader();

    myReader.onload = (event) => {
      codeReader.decodeFromImage(undefined, event.target['result'])
        .then((result) => {
          console.log(result['text']);
        }).catch((err) => {
        console.log(err);
      });
    };

    myReader.readAsDataURL(e.target.files[0]);
  }

Here is the error log Exception {type: "NotFoundException", message: undefined}

is there anything wrong I am doing?

aleris commented 7 years ago

Hi,

It is a problem with the library itself not with your code for 1 and 4. Strange is that according with a test case I quickly build for case 1 it passes on nodejs side, however it does not work from browser and case 4 does not work at all even if it seems like a pretty simple and standard one. I will have to investigate it further.

2 and 3 are not QR codes, are UPC. These are not implemented yet, are included in roadmap in "oned" submodule but will take some time to get there.

ishaqbhojani commented 7 years ago

OK great, Any idea how much time it will take to fix this issue?

aleris commented 7 years ago

I do not currently have a focus on this project and will probably advance very slowly. The problem for this one was very simple, but hard to spot, because it manifested for some type of images only, here is the fix: https://github.com/aleris/zxing-typescript/commit/6c8e45939a5b23199652ad39dc77cd205cc19c06#diff-80c1be98d55c33dbadd1cc608aa591b6L27