jsQR icon indicating copy to clipboard operation
jsQR copied to clipboard

Cannot decode this image,But other software can

Open VKingi opened this issue 6 years ago • 7 comments

ims

VKingi avatar Jul 17 '19 17:07 VKingi

Are you trying to decode this image as is shown or through a camera? I'm asking because I also had problems feeding this library images which were generated, but when I took a picture of them, then it worked.

TomasHubelbauer avatar Jul 17 '19 18:07 TomasHubelbauer

Are you trying to decode this image as is shown or through a camera? I'm asking because I also had problems feeding this library images which were generated, but when I took a picture of them, then it worked.

Run our demo through PC and scan this qr code picture in my phone, and decodethe error. Can you decode this image by jsQR?

VKingi avatar Jul 20 '19 09:07 VKingi

I've got the same issue with QRCode of that dimension. I'm running the code through PC, not with a camera. Nevertheless jsQR extract binaryData, but the data field is empty.

totorelmatador avatar Aug 02 '19 10:08 totorelmatador

Any solution to decode binaryData?

francovp avatar Feb 19 '20 14:02 francovp

FWIW, this is what I get with [email protected]:

  binaryData: [
    176, 174, 201, 207,  82, 101,  98, 101,  99,  99,  97,  45,
    178, 169, 191, 205, 163, 172, 214, 187, 206, 170, 203, 188,
    196, 238, 182, 248, 189, 168, 161, 173, 161, 173,  13,  10,
    196, 227, 178, 187, 187, 225, 214, 170, 181, 192, 163, 172,
    213, 226, 212, 211, 194, 210, 181, 196, 182, 254, 206, 172,
    194, 235, 192, 239, 163, 172, 188, 196, 205, 208, 215, 197,
    206, 210, 182, 212, 196, 227, 181, 196, 206, 222, 207, 222,
    203, 188, 196, 238,  13,  10, 176, 174, 196, 227, 163, 172,
    213, 230, 181, 196,
    ... 14 more items
  ],
  data: '羇瞶籌羞罐豬',
  chunks: [
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '羇' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '瞶' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '籌' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '羞' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '罐' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '豬' },
    { type: 'byte', bytes: [Array], text: '' }
  ],

Is that what you expect, @VKingi?

eventualbuddha avatar Apr 29 '20 19:04 eventualbuddha

FWIW,这是我通过[email protected]获得的:

  binaryData: [
    176, 174, 201, 207,  82, 101,  98, 101,  99,  99,  97,  45,
    178, 169, 191, 205, 163, 172, 214, 187, 206, 170, 203, 188,
    196, 238, 182, 248, 189, 168, 161, 173, 161, 173,  13,  10,
    196, 227, 178, 187, 187, 225, 214, 170, 181, 192, 163, 172,
    213, 226, 212, 211, 194, 210, 181, 196, 182, 254, 206, 172,
    194, 235, 192, 239, 163, 172, 188, 196, 205, 208, 215, 197,
    206, 210, 182, 212, 196, 227, 181, 196, 206, 222, 207, 222,
    203, 188, 196, 238,  13,  10, 176, 174, 196, 227, 163, 172,
    213, 230, 181, 196,
    ... 14 more items
  ],
  data: '羇瞶籌羞罐豬',
  chunks: [
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '羇' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '瞶' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '籌' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '羞' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '罐' },
    { type: 'byte', bytes: [Array], text: '' },
    { type: 'kanji', bytes: [Array], text: '豬' },
    { type: 'byte', bytes: [Array], text: '' }
  ],

@VKingi是您所期望的吗?

Yes, it seems to be the data I want! After analysis, the qr code data seems to be ANSI coding,Byte [] converted to string error.

VKingi avatar Apr 30 '20 04:04 VKingi

Existing solutions:

// Create the Uint8Array array
let uint8Array = new Uint8Array(code.binaryData);
// encodings: Specify the required encoding
alert( new TextDecoder(encodings).decode(uint8Array) );

Intelligent automatic recognition code would be better ... : )

VKingi avatar Apr 30 '20 04:04 VKingi