Skip to content

Missing edge tiles when viewing IIIF layout of dzsave in OpenSeadragon #1621

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

Closed
IllyaMoskvin opened this issue Apr 24, 2020 · 5 comments
Closed

Comments

@IllyaMoskvin
Copy link

IllyaMoskvin commented Apr 24, 2020

I'm processing an 11558 × 11081 pixel image with the following command:

vips dzsave in.jpg out --layout iiif --tile-size 256

However, I'm running into a problem where at smaller zooms, OpenSeadragon is attempting to request edge tiles that don't exist. Specifically, edge tiles at the right and bottom appear missing.

For example, here's a screenshot; I mocked up the part of the image that's missing in red:

missing-tiles

To be clear, all the tiles were generated for all the zoom levels. It's just that the URLs for the edge tiles do not match what OpenSeadragon expects. I suspect that this is an issue with vips and not OSD because we targeted the same OSD viewer at a Cantaloupe server and at a set of tiles that have been pre-generated using iiif-tile-seed from go-iiif. In both cases, all of the tiles that OSD expects were there. We used the same info.json in all three tests.

Here is OSD's current logic for generating IIIF tile URLS:

https://github.com/openseadragon/openseadragon/blob/519cbaccdec95339766485d21b1f34a6e2171252/src/iiiftilesource.js#L411-L430

In terms of vips version, I built it from source at the 93337f8 commit.

Could this be a rounding error? At the maximum zoom level, all of the tiles that OSD expects are there. I'm seeing a sort of sliding scale of errors, where at higher-but-not-max zoom levels, I begin to see tiles on the right edge as expected, but the tiles on the bottom remain missing. But as I zoom out further, the tiles on the right edge get lost, too.

I processed the same image with both vips and go-iiif, and diff'd the resulting folder structure. As mentioned above, go-iiif's output matches what OSD expects. Sorry if this is a bit long:

diff vips/ go-iiif/ | grep "Only"
Only in vips/:    0,0,11584,11136
Only in vips/:    0,0,8192,8192
Only in go-iiif/: 0,10240,1024,841
Only in vips/:    0,10240,1024,844
Only in go-iiif/: 0,10240,2048,841
Only in vips/:    0,10240,2048,848
Only in go-iiif/: 0,10752,512,329
Only in vips/:    0,10752,512,330
Only in go-iiif/: 0,8192,4096,2889
Only in vips/:    0,8192,4096,2896
Only in vips/:    0,8192,8192,2912
Only in go-iiif/: 1024,10240,1024,841
Only in vips/:    1024,10240,1024,844
Only in go-iiif/: 1024,10752,512,329
Only in vips/:    1024,10752,512,330
Only in go-iiif/: 10240,0,1318,2048
Only in vips/:    10240,0,1320,2048
Only in go-iiif/: 10240,10240,1024,841
Only in vips/:    10240,10240,1024,844
Only in go-iiif/: 10240,10240,1318,841
Only in vips/:    10240,10240,1320,848
Only in go-iiif/: 10240,10752,512,329
Only in vips/:    10240,10752,512,330
Only in go-iiif/: 10240,2048,1318,2048
Only in vips/:    10240,2048,1320,2048
Only in go-iiif/: 10240,4096,1318,2048
Only in vips/:    10240,4096,1320,2048
Only in go-iiif/: 10240,6144,1318,2048
Only in vips/:    10240,6144,1320,2048
Only in go-iiif/: 10240,8192,1318,2048
Only in vips/:    10240,8192,1320,2048
Only in go-iiif/: 10752,10752,512,329
Only in vips/:    10752,10752,512,330
Only in go-iiif/: 11264,0,294,1024
Only in vips/:    11264,0,296,1024
Only in go-iiif/: 11264,1024,294,1024
Only in vips/:    11264,1024,296,1024
Only in go-iiif/: 11264,10240,294,841
Only in vips/:    11264,10240,296,844
Only in go-iiif/: 11264,10752,294,329
Only in vips/:    11264,10752,294,330
Only in go-iiif/: 11264,2048,294,1024
Only in vips/:    11264,2048,296,1024
Only in go-iiif/: 11264,3072,294,1024
Only in vips/:    11264,3072,296,1024
Only in go-iiif/: 11264,4096,294,1024
Only in vips/:    11264,4096,296,1024
Only in go-iiif/: 11264,5120,294,1024
Only in vips/:    11264,5120,296,1024
Only in go-iiif/: 11264,6144,294,1024
Only in vips/:    11264,6144,296,1024
Only in go-iiif/: 11264,7168,294,1024
Only in vips/:    11264,7168,296,1024
Only in go-iiif/: 11264,8192,294,1024
Only in vips/:    11264,8192,296,1024
Only in go-iiif/: 11264,9216,294,1024
Only in vips/:    11264,9216,296,1024
Only in go-iiif/: 1536,10752,512,329
Only in vips/:    1536,10752,512,330
Only in go-iiif/: 2048,10240,1024,841
Only in vips/:    2048,10240,1024,844
Only in go-iiif/: 2048,10240,2048,841
Only in vips/:    2048,10240,2048,848
Only in go-iiif/: 2048,10752,512,329
Only in vips/:    2048,10752,512,330
Only in go-iiif/: 2560,10752,512,329
Only in vips/:    2560,10752,512,330
Only in go-iiif/: 3072,10240,1024,841
Only in vips/:    3072,10240,1024,844
Only in go-iiif/: 3072,10752,512,329
Only in vips/:    3072,10752,512,330
Only in go-iiif/: 3584,10752,512,329
Only in vips/:    3584,10752,512,330
Only in go-iiif/: 4096,10240,1024,841
Only in vips/:    4096,10240,1024,844
Only in go-iiif/: 4096,10240,2048,841
Only in vips/:    4096,10240,2048,848
Only in go-iiif/: 4096,10752,512,329
Only in vips/:    4096,10752,512,330
Only in go-iiif/: 4096,8192,4096,2889
Only in vips/:    4096,8192,4096,2896
Only in go-iiif/: 4608,10752,512,329
Only in vips/:    4608,10752,512,330
Only in go-iiif/: 512,10752,512,329
Only in vips/:    512,10752,512,330
Only in go-iiif/: 5120,10240,1024,841
Only in vips/:    5120,10240,1024,844
Only in go-iiif/: 5120,10752,512,329
Only in vips/:    5120,10752,512,330
Only in go-iiif/: 5632,10752,512,329
Only in vips/:    5632,10752,512,330
Only in go-iiif/: 6144,10240,1024,841
Only in vips/:    6144,10240,1024,844
Only in go-iiif/: 6144,10240,2048,841
Only in vips/:    6144,10240,2048,848
Only in go-iiif/: 6144,10752,512,329
Only in vips/:    6144,10752,512,330
Only in go-iiif/: 6656,10752,512,329
Only in vips/:    6656,10752,512,330
Only in go-iiif/: 7168,10240,1024,841
Only in vips/:    7168,10240,1024,844
Only in go-iiif/: 7168,10752,512,329
Only in vips/:    7168,10752,512,330
Only in go-iiif/: 7680,10752,512,329
Only in vips/:    7680,10752,512,330
Only in go-iiif/: 8192,0,3366,4096
Only in vips/:    8192,0,3376,4096
Only in vips/:    8192,0,3392,8192
Only in go-iiif/: 8192,10240,1024,841
Only in vips/:    8192,10240,1024,844
Only in go-iiif/: 8192,10240,2048,841
Only in vips/:    8192,10240,2048,848
Only in go-iiif/: 8192,10752,512,329
Only in vips/:    8192,10752,512,330
Only in go-iiif/: 8192,4096,3366,4096
Only in vips/:    8192,4096,3376,4096
Only in go-iiif/: 8192,8192,3366,2889
Only in vips/:    8192,8192,3376,2896
Only in vips/:    8192,8192,3392,2912
Only in go-iiif/: 8704,10752,512,329
Only in vips/:    8704,10752,512,330
Only in go-iiif/: 9216,10240,1024,841
Only in vips/:    9216,10240,1024,844
Only in go-iiif/: 9216,10752,512,329
Only in vips/:    9216,10752,512,330
Only in go-iiif/: 9728,10752,512,329
Only in vips/:    9728,10752,512,330

Related issues: #1465, go-iiif/go-iiif#20, maybe #1611 and #659?

Thank you for your time!

@jcupitt
Copy link
Member

jcupitt commented Apr 24, 2020

I agree, I tried against git master magick_tile and I see some differences. I tested like this:

python3 ~/GIT/magick_tile/magick_tile.py -o magick_tile ~/pics/wtc.jpg
vips dzsave --layout iiif --tile-size 256  ~/pics/wtc.jpg dzsave 
ls magick_tile/ > magick_tile.list
ls dzsave/ > dzsave.list
diff -c magick_tile.list dzsave.list > diff
*** magick_tile.list	2020-04-24 17:12:23.394607062 +0100
--- dzsave.list	2020-04-24 17:12:29.878674241 +0100
***************
*** 4,9 ****
--- 4,10 ----
  0,0,4096,4096
  0,0,512,512
  0,0,8192,8192
+ 0,0,9408,9408
  0,1024,1024,1024
  0,1024,256,256
  0,1024,512,512
***************
... etc.

I'll see if I can work out why they are different.

jcupitt added a commit that referenced this issue Apr 24, 2020
We were clipping edge tiles against the size of the scaled up layer.
Instead, clip against the size of the top level image.

See #1621
@jcupitt
Copy link
Member

jcupitt commented Apr 24, 2020

I might have fixed it!

Would you be able to test git master libvips? The change is on the head of the 8.9 branch as well.

@IllyaMoskvin
Copy link
Author

Wow! Thank you for the quick response. Sure thing, I'll test it right away.

@IllyaMoskvin
Copy link
Author

Confirmed! OpenSeadragon is now rendering everything as expected. Thanks again!

@jcupitt
Copy link
Member

jcupitt commented Apr 25, 2020

Good stuff, this fix will be in 8.9.3. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants