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

Document how to use image #123

Open
poissoj opened this issue Oct 20, 2020 · 2 comments
Open

Document how to use image #123

poissoj opened this issue Oct 20, 2020 · 2 comments

Comments

@poissoj
Copy link

poissoj commented Oct 20, 2020

I had to dig for the following information to understand why the QRCode I was generating was not working:

There's an inherent risk to using an image in the QR Code. Specifically the risk is that it takes away too much of the actual scannable portion. By excavating (as seems to be the difference in your demos) you're actually taking away even more modules, not just the ones that are getting covered by the image. I don't have any protections in there to prevent embedding an image that covers up more than the error correction level can handle (the math got messy, transparent images change the math) so if you find yourself with a QR Code that doesn't scan, you need to correct that yourself. You have 2 options:

  1. Change the ratio of QR Code to image size. Make the image smaller or the QR Code bigger.
  2. Increase the Error level (level), which will result in smaller modules with a better ability to handle covered areas.

Originally posted by @zpao in #100 (comment)

@poissoj poissoj changed the title There's an inherent risk to using an image in the QR Code. Specifically the risk is that it takes away too much of the actual scannable portion. By excavating (as seems to be the difference in your demos) you're actually taking away even more modules, not just the ones that are getting covered by the image. I don't have any protections in there to prevent embedding an image that covers up more than the error correction level can handle (the math got messy, transparent images change the math) so if you find yourself with a QR Code that doesn't scan, you need to correct that yourself. You have 2 options: Document how to use image Oct 20, 2020
@poissoj
Copy link
Author

poissoj commented Oct 20, 2020

This comment helped me figure out why my QRCode was invalid when I added an image inside.
I increased the error correction level, and it worked.
I think this deserves more visibility.

@LiamBorner
Copy link

Many, many thanks for pointing this out. Agreed, this detail should be added to the documentation somewhere

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

2 participants