Skip to content

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Feb 10, 2020

Fixes #4378 | Demo

@plotly/plotly_js
cc: @alexcjohnson

@archmoj archmoj added bug something broken status: reviewable labels Feb 10, 2020
var q = 255 / a;

for(var l = 0; l < 3; ++l) { // RGB
pixels[k + l] = Math.min(q * pixels[k + l], 255);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@etpinard etpinard added this to the v1.53.0 milestone Feb 10, 2020
@etpinard
Copy link
Contributor

💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

difference between live 3-D graph with downloaded PNG

2 participants