Pixel rounding error in IIIF
klokan opened this issue · comments
There seems to be a rounding error in the implementation of IIIF tile requests submitted to the server.
For example at:
http://klokantech.github.io/iiifviewer/examples/permalink.html#zoom=1&lat=1880.5&lon=3559.8&layers=T
The tile on the left is blurred (probably resized on the client side):
and there is a pixel step visible as well:
This seems to be caused by both client and server.
Compare these tiles:
- http://iiif.klokantech.com/demo.jp2/0,4096,4096,4096/pct:6.25/0/native.jpg
- http://iiif.klokantech.com/demo.jp2/0,4096,4095,4096/pct:6.25/0/native.jpg
The second one should be 1/16 pixel narrower than the first one (which is obviously not possible), but the first one ("blurry") seems to be sampled completely differently than the second one (even in the y axis).
I suspect this is because it is not possible to read the image data from some precalculated cache structure.
The client-side solution is to round the request boundaries on the client side (always request tiles with dimensions rounded to 100 / pct
(16 in this case (at this zoom level)) instead of requesting tiles with non-integer dimensions (255.9375 in this case).
Then the requests seem to be working as expected:
3) http://iiif.klokantech.com/demo.jp2/0,4096,4080,4096/pct:6.25/0/native.jpg
@klokan I implemented the rounding fix, but now the whole map is "blurred" (some filtering on the server-side).
@daliborjanak I only updated the builds without the pdf support (build from the code in the master
branch) since I'm not familiar with the pdf
branch.
@petrsloup pdf builds updated also little cleaning in PDF branch.