How to use irregular image pyramids? IIIF
See original GitHub issueMy underlying images are irregular image pyramids. E.g., a typical image has following IIIF structure:
{
"profile" : ["http://iiif.io/api/image/2/level2.json", {
"supports": ["canonicalLinkHeader", "profileLinkHeader", "mirroring", "rotationArbitrary", "sizeAboveFull", "regionSquare"],
"qualities" : ["default", "bitonal", "gray", "color"],
"formats" : ["jpg", "png", "gif", "webp"]
}],
"tiles" : [{
"width" : 512,
"scaleFactors" : [1, 4.0001689138501408, 16.002226468764611]
}],
"protocol" : "http://iiif.io/api/image",
"sizes" : [{
"width" : 61917,
"height" : 43923
}, {
"width" : 15479,
"height" : 10980
}, {
"width" : 3869,
"height" : 2745
}],
"height" : 43923,
"width" : 61917,
"@context" : "http://iiif.io/api/image/2/context.json",
"@id" : "http://imageserver/image.jp2"
}
The scaling is not smooth at 1, 4, 16
, but 1, 4.0001689138501408, 16.002226468764611
.
Still, OSD will as me for tiles of a regular pyramid with sizes at the power of 2. Typical requests are:
/imageserver/image.jp2/49152,40960,8192,2963/512,/0/default.jpg
/imageserver/image.jp2/0,32768,8192,8192/512,/0/default.jpg
/imageserver/image.jp2/0,0,8192,8192/512,/0/default.jpg
/imageserver/image.jp2/0,40960,8192,2963/512,/0/default.jpg
/imageserver/image.jp2/57344,0,4573,8192/286,/0/default.jpg
/imageserver/image.jp2/57344,40960,4573,2963/286,/0/default.jpg
/imageserver/image.jp2/24576,16384,4096,4096/512,/0/default.jpg
/imageserver/image.jp2/20480,16384,4096,4096/512,/0/default.jpg
/imageserver/image.jp2/40960,26624,2048,2048/512,/0/default.jpg
resulting in a lot of rescaling work since e.g. when OSD asks for a 8192 wide region with a 512 size, the downsample is exactly 16.
The “best level for downsample” is in this case the orginal level 1 (with downsample 4.000169) which is then of course way too large and has to be downscaled.
Level 2 is not suitable, since it has the downscale factor 16.0022, and this would lead in a slightly to small patch which would have to be upscaled.
In any case, downscaling or upscaling is involved, slowing the image server down. Therefore, I have two related questions:
-
Why is OSD asking for a 8192 sized tile (downsample 16), and not for a 8193 sized tile (downsample 16.0020) which would better fit the provided scaling factor?
-
What is your recommendation for this kind of irregular image pyramids?
Thanks for your thoughts!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
It’s not a valid IIIF Image API implementation, as scalefactors are required to be integers, not floats. There is a feature request for 3.0 that the OP should submit their use cases to: https://github.com/IIIF/api/issues/447 The issue is currently closed, as we lack use cases to support its inclusion.
I actually don’t know if that’s the case. The LegacyTileSource certainly allows you to give it non-power-of-two tiles. I don’t know if it’s somehow translating them to powers of two internally. A quick look at the code for it hasn’t really enlightened me; have you taken a look at it?
At any rate, the other side to look from TiledImage._updateViewport, and see how it handles levels.