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

add a to_b64 function #247

Open
mchant opened this issue Nov 17, 2024 · 4 comments
Open

add a to_b64 function #247

mchant opened this issue Nov 17, 2024 · 4 comments

Comments

@mchant
Copy link

mchant commented Nov 17, 2024

Would it be useful if I create a PR for a to_b64 function? It's pretty much a copy of the write_image function, but returns a b64 string rather than write to a file.

@andrei-ng
Copy link
Collaborator

andrei-ng commented Nov 17, 2024

Hi @mchant ,

Isn't to_html or to_inline_html sufficient for this use-case?

@mchant
Copy link
Author

mchant commented Nov 17, 2024

Thanks for the reply, @andrei-ng. Those functions return html that makes a call to plotly. If someone just wants data for a picture, they can use this tag <img src="data:image/jpeg;base64,{b64_string_here}"> and pass in the string. This also returns a fairly consistent data length no matter how much data is used in the plot. In an HTTP API environment, this makes a more predictable load time because the data returned is not dependent on the length of x and y.

@andrei-ng
Copy link
Collaborator

Hi @mchant. Thanks for the clarification. Yes, please submit a PR and I will merge it in. If you need to use an external crate to achieve this, I think it is better to put it behind a feature flag.

@mchant mchant mentioned this issue Nov 17, 2024
@mchant
Copy link
Author

mchant commented Nov 22, 2024

Hi, @andrei-ng , it's in PR #251

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