question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IIIF - possible wrong calculation of tile width

See original GitHub issue

I have this image served by IIPImage server:

{
"@context": "http://iiif.io/api/image/2/context.json",
"protocol": "http://iiif.io/api/image",
"width": 2609,
"height": 3424,
"sizes": [
{
"width": 163,
"height": 214
},
{
"width": 326,
"height": 428
},
{
"width": 652,
"height": 856
},
{
"width": 1304,
"height": 1712
}
],
"tiles": [
{
"width": 256,
"height": 256,
"scaleFactors": [
1,
2,
4,
8,
16
]
}
],
"@id": "http://iip.test/iiif/f.jp2",
"profile": [
"http://iiif.io/api/image/2/level2.json",
{
"formats": [
"jpg",
"png",
"webp"
],
"qualities": [
"native",
"color",
"gray",
"bitonal"
],
"supports": [
"regionByPct",
"regionSquare",
"sizeByForcedWh",
"sizeByWh",
"sizeAboveFull",
"sizeUpscaling",
"rotationBy90s",
"mirroring"
],
"maxWidth": 3500,
"maxHeight": 3500
}
]
}

When used with Openseadragon viewer I get these IIIF API calls:

First row:

Second row:

The content of the last tile column appears dropped a bit when zoomig out or on a small displays.

iip_iiif_osd

As @ruven kindly pointed out at https://github.com/ruven/iipsrv/issues/237#issuecomment-1235444340 it looks like the width parameter seems probably miscalculated resulting in bad tile height.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
azaroth42commented, Sep 7, 2022

Could you try modifying your local copy for these lines: https://github.com/openseadragon/openseadragon/blob/master/src/iiiftilesource.js#L401-L402 to use floor instead of ceil, and see if it works as expected?

(2609 - 2048) / 8 is 70.125, and the ceil makes it a width of 71. The top left of the region is correct in the second column, as is the width (561) and height (2048). So the only other parameter to manipulate is the desired size which has to be a whole number of pixels. Asking for a width of 71, when the number of pixels is 561 is 0.12656, times the height of 2048 is 259, giving you the three undesirable pixels.

That said, this has been working for a long time now so I’m surprised it hasn’t come up before

0reactions
iangilmancommented, Dec 7, 2022

Fixed by #2206.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IIIF - last (non-square) tile in each row has incorrect (bigger) height ...
It's using a "tile" width of 2048 for the first IIIF request (left tile on the full-size image) and if we calculate the...
Read more >
Image API 2.1.1 - IIIF
Each description gives a width, optionally a height for non-square tiles, and a set of scale factors at which tiles of those dimensions...
Read more >
Wrong tile resolution when using OpenLayers to display local ...
source.IIIF({ size: [config.map.width, config.map.height], extent: extent, projection: projection, tileSize: tileSize, resolutions: [1, 2, 4], }); ...
Read more >
Tiling Problem - GeeksforGeeks
Given a “2 x n” board and tiles of size “2 x 1”, count the number of ... Please write comments if you...
Read more >
Defining Normal and Abnormal Fetal Growth - NCBI - NIH
In summary, an ideal definition of FGR should take into account the growth potential of the fetus, current fetal size, fetal and placental...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found