-
Notifications
You must be signed in to change notification settings - Fork 45
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
Zoom level issues with IIIF images #306
Comments
I've put the example image (and two other random examples with the same problem) into a little demo: The following shows the behaviour with maxZoom calculated from the maximum resolution: |
While the solution I suggested improves the viewers behaviour and using powers of 2 as resolutions if no scaleFactors are given will work smoothly, there remains the problem that the scaleFactors provided by an info.json do not have to be consecutive values of powers to 2. In fact, any positive integer is allowed. This is bound to cause conflicts with OpenLayers whose default zoomFactor 2 will not work together with an arbitrary set of scaleFactors provided by an info.json. So additionally I'd suggest that the scaleFactors are to be ignored if they are not a consecutive sequence of powers to 2 after sorting. In that case the viewer should provide a set of resolutions calculated from maxZoom. Size by percentage must be supported by all IIIF image servers at level 1 and 2, so the only problem may be performance issues if the calculated resolutions perform worse than the scaleFactors from the image's info.json. |
I have updated the working demo with the solution from the pull request. |
Fix #306 - resolve zoom level issues
Fix for upstream; patch ported from kitodo/kitodo-presentation#308 - see issue kitodo/kitodo-presentation#306
In
dlfViewerSource.IIIF
, a value formaxZoom
is calculated that is later used by the source to determine the correct scale for a given zoom level.kitodo-presentation/plugins/pageview/tx_dlf_ol3_source.js
Lines 93 to 97 in e78f284
If the zoom levels from 0 to
maxZoom
and the reverse values inresolutions
(which originate from the IIIF image scale factors) do not correspond, the IIIF tile source will provide tiles for the wrong zoom level.An Example
height
of 1883 pixels (which is greater than thewidth
), a tile width of 512 pixels and thescaleFactors
[1,2,4,8,16]
maxZoom
would be 2 as 2^2=4 tiles of 512x512 pixels are enough to contain the height of 1883 pixels[16,8,4,2,1]
which is 4 (ie. 1/4 of the full image resolution)kitodo-presentation/plugins/pageview/tx_dlf_ol3_source.js
Line 142 in e78f284
Possible solution
resolutions
are provided,maxZoom
should be determined from those resolutions as logarithm to base 2 of the maximum resolutionscale_factors
is optionaltiles
is optional; iftiles
is not givenscaleFactors
is not given either; iftiles
exists each entry it must containscaleFactors
[1,2,4,8,16]
as I had suggested in dlfUtils.buildImageV2() requires "tiles" which is optional according to specification #279 but rather be calculated from the then correctly calculatedmaxZoom
(with values ranging from 2^0 to 2^maxZoom)I could provide a pull request for that solution.
The text was updated successfully, but these errors were encountered: