These are chat archives for openseadragon/openseadragon

Sep 2017
Julie Harris
Sep 11 2017 12:56
Hi all, my team of developers are stuck trying to centre an image on the canvas at loading. They've already tried 'fitbounds' and 'panTo' already. Does anyone have any other methods they can suggest?
Ian Gilman
Sep 11 2017 16:43
@Kampenuss_twitter I don't know of any add on for OpenSeadragon that would change white pixels to transparent ones. If your original image is png and has transparent pixels, OpenSeadragon will honor them. I suppose you could do a post-processing pass that goes through the canvas after every frame and removes white pixels. Of course you'd have to worry about fringing (with pixels that aren't quite white).
Another option would be to add a hook that processes every tile after it's loaded (OSD has a mechanism for that) and remove the white pixels then.
@julesharris129_twitter I'm guessing they just need to do their centering within an event listener for "open". viewer.addHandler('open', centerMyImage)
(where centerMyImage is your function, of course)
Cameron Baney
Sep 11 2017 19:24
@iangilman Thanks for the feedback on the PR I submitted. I will address that soon. I ran into another issue that I could address as an enhancement in that same PR. When OpenSeadragon creates a navigator, it will create a new div and place everything inside of that. This isn't necessary if specifying an ID (or in my case, specifying the element) and it is causing some style issues. I cannot find out where this wrapper div is being created, can you point me in the right direction?
Ian Gilman
Sep 11 2017 19:59
@cameronbaney I'm guessing it's probably in the viewer constructor (remember, navigator is a subclass of viewer). What sort of styling issues is it creating?
Cameron Baney
Sep 11 2017 20:16
It is removing the element I'm passing in, wrapping it in a div, and then appends the newly created div to the container. Actually, to circumvent that I could probably wrap a div around the element I'm specifying
yeah, that does the trick!
Just needed to rubber ducky I guess. Thanks
Ian Gilman
Sep 11 2017 21:15
@cameronbaney Cool :)
Do you think that's an acceptable work flow, or is there something that could be done to improve it on the OSD side?
(keeping in mind what OSD needs to do to accomplish its mission, of course)