jsQR icon indicating copy to clipboard operation
jsQR copied to clipboard

Error: Malformed data passed to binarizer.

Open jarawin opened this issue 1 year ago • 2 comments

jarawin avatar May 09 '23 09:05 jarawin

same here, what is wrong?

crapthings avatar Jul 05 '23 15:07 crapthings

You need to provide more detail. This error usually comes up when the passed in image data has something other than 4 channels. This can either be fixed by converting your input to rgba:

for (let i = 0; i < rgbArray.length; i += 3) {
  rgbaArray[i] = rgbArray[i];
  rgbaArray[i + 1] = rgbArray[i + 1];
  rgbaArray[i + 2] = rgbArray[i + 2];
  rgbaArray[i + 3] = 255; // Alpha channel set to 255 (fully opaque)
}

or by editing the source to understand rgb <- Way more efficient, but would need to be done by a maintainer of the reop.

LaserKaspar avatar Oct 27 '23 00:10 LaserKaspar