-
Notifications
You must be signed in to change notification settings - Fork 108
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
Save static image #51
Comments
hey @wronk, We currently have an endpoint that exposes the visualizations as images, with the following URL structure:
e.g. running locally:
there's a shortcut to this link that can be accessed from the "actions dropdown" on the server: |
Awesome, thanks. Is there any way to do that within a script? |
(assuming you are in the python client) There's no builtin method in the client right now, but you could do it like this: # imports and initialize client
import urllib
from lightning import Lightning
lgn = Lighting()
data = [1, 2, 3, 4, 5]
viz = lgn.line(data)
image_url = viz.get_perma_link() + '/screenshot'
# or with size parameters
# image_url = viz.get_perma_link() + '/screenshot?width=100&height=100'
# save it locally
# referenced from http://stackoverflow.com/questions/8286352/how-to-save-an-image-locally-using-python-whose-url-address-i-already-know
urllib.urlretrieve(image_url, "local-filename.png") I would be happy to accept a PR encapsulating this functionality into the python client. If you want to take a shot it can be as straightforward as adding an additional method to the visualization class here |
Yup I think that's what we're missing. Two things would probably be good to have:
We can start by adding (1) to the Python client, and then try to tackle (2). ---------------------------jeremyfreeman.net @thefreemanlab On Mon, Aug 31, 2015 at 2:58 PM, wronk [email protected] wrote:
|
yeah, (2) is going to need to use something like http://html2canvas.hertzen.com/ or a similar approach |
@mathisonian, I probably won't get to it anytime soon, but I'll let you guys know on this thread the moment it moves up on my priority list :) |
sounds good @wronk, let us know if you run into anything else. I've created an issue on the python client: lightning-viz/lightning-python#29, going to close this in favor of that one |
I dabble in some graph theory, and it would be great to have a way to save your visualizations to a image and/or vector format for non-web formats. Something like matplotlib's
img.savefig('my_path')
would be awesome (even though it throws away all the interactive functionality).The text was updated successfully, but these errors were encountered: