-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
Inverted QR codes (#94) #766
base: master
Are you sure you want to change the base?
Conversation
I'm using this version to be able to scan inverted QR codes and it works on my mac but it doesn't work in iOS on my iPhone. Any ideas why this is and how to get it working? Normal QR codes work. |
Hi @joncon62, |
@fante90 it's supported on Safari, but there is a bug reported here |
@ROBERT-MCDOWELL from what I understand is not supported, it's not a bug, see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter |
@fante90 yes it's a bug, click on browser compatibility table -> safari -> https://bugs.webkit.org/show_bug.cgi?id=198416 |
@ROBERT-MCDOWELL keep calm, we are here to talk. |
@fante90 I'm calm, I just can't stand people not believing what I'm saying, it's waste of time for me... |
@ROBERT-MCDOWELL have you ever heard of polyfill? https://github.com/davidenke/context-filter-polyfill |
if you want to add a full polyfill js file on top of html5-qrcode just for one function so do it. |
@ROBERT-MCDOWELL I simply took the invert function from that polyfill and it works. thank you |
@fante90 did you create a new html5-qrcode.min.js ? I can see you modified html5-qrcode.ts but I don't know what to do with that, sorry! |
@joncon62 if you see my commits, I’ve ever commit only html5-qrcode.ts never the files in dist folder. In order to obtain the js file checkout my branch and follow this instructions https://github.com/mebjas/html5-qrcode?tab=readme-ov-file#how-to-modify-and-build |
I managed to build the .js file and tested it out. I can't get inverted QR codes to work on my iPhone in either Safari or Chrome browsers. Normal QR codes do work. |
Can you share your QR code? |
Here are the normal and dark codes: Now I see them together I just noticed that the dark one is not inverted, it just has a dark border. This was created by putting the phone into 'dark mode' - any idea how I can get this to be recognised? Also, both codes are recognised if I scan them on a mac with this code, the 'dark' one doesn't work on an iPhone. |
@joncon62 html5-qrcode (and probably most of qr-code scanners) need this white border to clearly differentiate the black squares which are data. if the border is dark and touching these black square so indeed it won't gues if it's data or the border. |
create an image batch automation with photoshop or maybe on line tool |
Unfortunately the QR codes are in customer emails already sent out so I can't change them. This is only a problem for people who choose to use dark mode and we can always ask them to turn light mode back on - but it's a bit of a hassle and many don't even know how to do that! Is there a way to scan a QR code without a quiet zone? Can a pseudo quiet zone be added to the canvas? |
what you can do is before the scanner capture function make a new function that capture one frame from the canvas then manipulate the image adding a white square around then provide this frame to the html5-qrcode scanner function |
@joncon62 this is out of the scope of the PR. Please open an issue if you need to support QR codes without border, this PR is about inverted colours (black background). |
Hi @mebjas
I'm using your library and I caught in the same problem of #94 and I tried to solve the issue.
My code tries to scan the QR Code in the four possible cases:
I did some tests in various color combinations always getting a positive result when the contrast between background and foreground is quite clear.
If you had some time to have a look, I would be happy to have your opinion.
Regards
@fante90