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 support? #85

Open
s4m0r4m4 opened this issue Jun 23, 2020 · 4 comments
Open

Canvas support? #85

s4m0r4m4 opened this issue Jun 23, 2020 · 4 comments

Comments

@s4m0r4m4
Copy link

Hello! I think the answer is "no", but I wanted to check - does iv-viewer support zoom/pan on canvas images? For instance, if I have an HTMLCanvasElement, can I pass that to iv-viewer rather than an html image element?

Great library, thank you!

@s4m0r4m4
Copy link
Author

Howdy, just checking on this. Canvas support would be an awesome feature!

@s4m0r4m4
Copy link
Author

@s-yadav, I just wanted to check in and get your thoughts on this issue. Thanks!

@s-yadav
Copy link
Owner

s-yadav commented Aug 31, 2020

Hey, @s4m0r4m4. Sorry missed replying earlier on this. Currently, it does not support canvas. I would like to understand the use case for HTMLCanvasElement.

Ideally, you can get the data URL from canvas canvas.toDataURL() and pass the data URL as img url on the load method.
https://github.com/s-yadav/iv-viewer#instance-methods

@s4m0r4m4
Copy link
Author

s4m0r4m4 commented Sep 2, 2020

Hello! My use case is that I have very large images (~200-400MB) that are sent to my app via websocket. I can't afford to render these in the main thread (it locks up the UI for too long!), so I am using a webworker to render that image in an offscreen canvas, along with rendering other items in the canvas.

To use your canvas.toDataURL() approach, I would have to run that in the worker and send the data URL back to the main thread and then pass it to iv-viewer. That data URL will be quite large, so there will be a performance hit.

It's probably not a good use case for this library, but I figured I would check to see perhaps there was a solution I was missing. Thanks for your reponse!

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