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

I have a small question about calculating the image rgb value. #327

Open
Minyeol-Lee opened this issue Sep 1, 2020 · 1 comment
Open

Comments

@Minyeol-Lee
Copy link

First of all, thank you so much for making such a good library. I'm using it really well.

So..
I'm trying to analyze the heatmap algorithm.
and I have a few questions when drawing heatmap images.

like the image below
i wonder how to calculate the rgb value in this case!

I would be very grateful if you could answer me.
thanks.

question

@helenawang
Copy link

Hi, I'm also curious about how to calculate the colors, especially the overlap part.

After checking the code of heatmap.js and APIs of canvas, I think the calculation of colors is handled by the composite operation of canvas instead of heatmap.js itself, and the details are hidden from us.
However, there are some formulas at standards and https://drafts.fxtf.org/compositing/#simplealphacompositing, which might be helpful to figure out "how to calculate the rgb".

Besides, If you just want to get the exact rgb value of each pixel from the overlap area, perhaps the getImageData API of canvas can help.

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