-
Notifications
You must be signed in to change notification settings - Fork 7
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
Remote images are lost when saving an Altair chart #59
Comments
Thanks for the report @binste. Are the remote images present if you save to SVG? I'm guessing resvg handles loading image references when they are local but doesn't pull them from remote sources. So we'll probably need to download them to a temp directory at some point in the pipeline (not sure if it would be easier to do this at the Vega and Vega-Lite spec level or at the SVG level). |
They are present if I save as SVG and they are embedded as e.g. Yeah the temp directory solution sounds reasonable. I'm not familiar with resvg so don't know if it has any capabilities to override how it converts external images? Or as you said, the images could be replaced in the Vega/VL specs or maybe in the SVG string itself but I guess that would require some SVG manipulation library. |
resvg relies on usvg for the initial SVG processing, and it looks like it's possible to override the image url resolver: https://docs.rs/usvg/latest/usvg/struct.ImageHrefResolver.html#
|
Released in version 0.10.1 |
When saving an Altair chart which references remote images, those images are lost. It works if I first save the images locally and reference them on the file system. Is there a way how vl-convert could fetch those images and include them? I think this would in general be nice for image marks, but my specific use case is that I'm working on adding support for basemaps in Altair/Vega-Lite. The tiles are loaded from an arbitrary XYZ server using the same approach as in the code example below. See this VL PR for a full VL spec and a screenshot of what it looks like. (I might first implement this functionality in an altair extension package before it hopefully lands in VL)
Code example
Saving this chart gives me the following:
The text was updated successfully, but these errors were encountered: