iv-viewer
iv-viewer copied to clipboard
Canvas support?
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!
Howdy, just checking on this. Canvas support would be an awesome feature!
@s-yadav, I just wanted to check in and get your thoughts on this issue. Thanks!
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
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!