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

question about hard coded adjustments to rgb #3

Open
ctrager opened this issue Jun 7, 2020 · 1 comment
Open

question about hard coded adjustments to rgb #3

ctrager opened this issue Jun 7, 2020 · 1 comment

Comments

@ctrager
Copy link

ctrager commented Jun 7, 2020

Why this line?
var pixelDiff = rgba[i] * 0.3 + rgba[i + 1] * 0.6 + rgba[i + 2] * 0.1;

Where did the 0.3, 0.6, 0.1 come from?

@chrisblakley
Copy link

Those values are how to calculate color luminance. You multiply them against the R, G, and B values respectively as shown in the formula for pixelDiff.

Here is some more info about that: https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color

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