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 divide by zero with some background image #20

Closed
martialDevOrange opened this issue Aug 24, 2017 · 1 comment
Closed

error divide by zero with some background image #20

martialDevOrange opened this issue Aug 24, 2017 · 1 comment

Comments

@martialDevOrange
Copy link

Hi,

with some drawable as background image, i have an error divide by zero :
System.err: java.lang.ArithmeticException: divide by zero System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.getDominantColor(AwesomeQRCode.java:377) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.render(AwesomeQRCode.java:116) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.create(AwesomeQRCode.java:92) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode.access$700(AwesomeQRCode.java:22) System.err: at com.github.sumimakito.awesomeqr.AwesomeQRCode$Renderer$1.run(AwesomeQRCode.java:526)

sumimakito added a commit that referenced this issue Aug 25, 2017
Fixed the "divide by zero" error mentioned in #20.
@sumimakito
Copy link
Owner

I think the issue may be caused by a background image with no pixels satisfying the statement r<200 && g<200 && b<200, which is used for computing the dominant color without involving too much "light" colors since the foreground and background color of a QR code should not be quite similar.

Anyway, the issue was fixed in commit cef3844.

Cheers 🍻

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