-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix download images to match live gl3d plot #4566
Conversation
var q = 255 / a; | ||
|
||
for(var l = 0; l < 3; ++l) { // RGB | ||
pixels[k + l] = Math.min(q * pixels[k + l], 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can explain why we need to apply this transform when exporting images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike openGL, webGL premultipliedAlpha
in enabled by default.
To get correct RGB values from the webgl context it was needed to devide RGB values by alpha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, what would happen if we instead disable premultipliedAlpha
on image exports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question; but that didn't work: demo.
💃 |
Fixes #4378 | Demo
@plotly/plotly_js
cc: @alexcjohnson