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

Can't get the library to detect QR codes.

pneves001 opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.
I installed this through nodejs with the following command,

npm i @zxing/library

Can't get the library to detect QR codes. Its throwing a NotFoundException and never detects a valid QR code. The comments says you turned off one of the checks QRBlackBox. I think that was a valid test that failed cuz the library doesn't seem to work now.

To Reproduce
Steps to reproduce the behavior:

Using the folloowing example I'm unable to get this to detect QR codes. I am grabbing the image from the canvas control using const img = context.getImageData(0,0,width,height)

And then I'm passing the data in using to the RBGLuminanceSource(img.data, width, height)

`/
import { MultiFormatReader, BarcodeFormat } from '@zxing/library';

const hints = new Map();
const formats = [BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX/, .../];

hints.set(DecodeHintType.POSSIBLE_FORMATS, formats);

const reader = new MultiFormatReader();

const luminanceSource = new RGBLuminanceSource(imgByteArray, imgWidth, imgHeight);
const binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));

reader.decode(binaryBitmap, hints);`

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac OS X Big Sir 11.7.2
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

Additional context
This used to work. I don't understand why all of a sudden it doesn't. The control hasn't changed. I've tried instead of using the MultiFormatReader just putting in the QRCodeReader with no result. It would be nice to be able to do multiformat reading. But currently it just doesn't work.

If you don't wish to update this anymore could you please advise a version of this library that works? this will allow me to get it working and get my project done thanks.

I have gotten the zxing-js/browser package to work up to the point where it throws a ChecksumException. However, thats farther than I've gotten with this package and it appears to use this package.