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
Example image:
I think this is a bug, so for now I solved it as follows. Before adding an image to the canvas, I fill it with a white square.
const canvas = document.createElement("canvas"); const ctx = canvas.getContext("2d"); canvas.width = img.width; canvas.height = img.height; ctx.fillStyle = "#fff"; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.drawImage(img, 0, 0); const image = ctx.getImageData(0, 0, img.width, img.height); const result = jsqr(image.data, image.width, image.height);
The text was updated successfully, but these errors were encountered:
Example image:
![image](https://cdn.statically.io/img/private-user-images.githubusercontent.com/1864516/282919355-f4759777-39b8-49c6-a1d1-92181a18935b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MTIwMzIsIm5iZiI6MTcyMTQxMTczMiwicGF0aCI6Ii8xODY0NTE2LzI4MjkxOTM1NS1mNDc1OTc3Ny0zOWI4LTQ5YzYtYTFkMS05MjE4MWExODkzNWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTlUMTc1NTMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjUyMjNhY2ZmNTUyMzBmNGMwZGViMmFlMmFhZDI5YjA3ZDZkZjJjZmJjN2I5ZGMyNzY1YzYxNGI4ODk0ODY3ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.-DI0qO0WRmIdA_FezBwZB1EZMJZa0lOPpPCIKwPpdzg)
I think this is a bug, so for now I solved it as follows. Before adding an image to the canvas, I fill it with a white square.
The text was updated successfully, but these errors were encountered: