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

Canvas download as png utility function #9

Open
psychemedia opened this issue Jul 1, 2020 · 2 comments
Open

Canvas download as png utility function #9

psychemedia opened this issue Jul 1, 2020 · 2 comments

Comments

@psychemedia
Copy link

I notice that in your dual_canvas demo you have a utility function for generating a png from a canvas, with an example usage here invoked from a button click here.

Generating images from a canvas in the widget could be quite a common requirement, so would it make sense to for jp_proxy_widget, or a plugin to it, to offer a utility function supporting that natively?

I also have a use case where I am overlaying several canvases and want to grab a single image from those. The recipe here suggests one way of doing that; this suggests in turn an additional helper utility to make it easier grabbing a png from one or more canvases by way of a function that combines multiple canvases on one, and then saves the one as a png.

@AaronWatters
Copy link
Owner

Thanks. Yes I agree about the canvas capture. I intend to add this unless you implement it in a pull request first :).
There are a number of other minor performance fixes that need to be pushed to pip too, so this would be another
motivation for a new release.

I'm not sure about combining multiple canvases -- it might be hard to figure out which canvas is on top of which.
It might make more sense to let the user implement the "combine" logic externally on a case by case basis.

@psychemedia
Copy link
Author

Re: the multiple canvases, this could also be complicated by how to arrange the canvases; eg size by side, all on top of each other if they are the same size, or relative to a fixed registration point ((0, 0), dead centre etc). My initial case is canvases all the same size, so an ordered list works fine. But the more general cases maybe been an anchor point and a scale value.

Re: new release: I notice there have been some commits to the repo lately (exciting:-); are there release notes anywhere? Any breaking changes to be wary of?

Re: a PR - I am iterating my widget/simulator with teaching materials atm, trying to get sim functionality that works for what I need teaching to do, and v.v.. The png save is on my "should have for assessment purposes" list but that's still a bit down my to do list (first student use isn't till October with late November assessment, although I'm already late on my handovers!) If I get anything half working in next few weeks, I'll post a note... Or I'll try to look at it properly when the teaching material is done... which is taking forevvvvveeerrrrr:-(

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