Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when decoding a high density qrcode #38

Open
lrossy opened this issue Aug 21, 2014 · 2 comments
Open

Error when decoding a high density qrcode #38

lrossy opened this issue Aug 21, 2014 · 2 comments

Comments

@lrossy
Copy link

lrossy commented Aug 21, 2014

When I try and use an image with any more characters then just a simple email or website, I keep getting a thrown exception that just says 'Error'

to reproduce, just go to the demo page: http://webqr.com/index.html

upload this qr:
download 3

It works fine for small qrcodes. When I upload the same graphic to http://zxing.org/w/decode it works.

Here is what is being passed into decode:

....scanQR = function(event) {

qrcode.callback = function(result) {... }

var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');

var img = new Image();
img.onload = function() {

if((img.width == 2448 && img.height == 3264) || (img.width == 3264 && img.height == 2448)) {
  canvas.width = 1024;
  canvas.height = 1365;
  context.drawImage(img, 0, 0, 1024, 1365);
} else if(img.width > 1024 || img.height > 1024) {
  canvas.width = img.width*0.15;
  canvas.height = img.height*0.15;
  context.drawImage(img, 0, 0, img.width*0.15, img.height*0.15);
} else {
  canvas.width = img.width;
  canvas.height = img.height;
  context.drawImage(img, 0, 0, img.width, img.height);
}
qrcode.decode(canvas.toDataURL('image/png'));

}

What am I doing wrong?

@dmborque314
Copy link

Looks like I have the same problem here.
I can decode QR codes as long as the string encoded is not longer than 300-some characters.
For longer strings I get an error (on my implementation) and an "error decoding QR code" in the web.

For example, working QR of a string 300 characters long:
qrcode300

and the qr of a sightly longer string:
qrcode311

@JMLX42
Copy link

JMLX42 commented Mar 27, 2016

Hi,

did you find a solution for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants