demo: make a bitmap of blank tiles instead of uploading them#144
Merged
Conversation
Conserve HTTP connections. Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
S3 can't negotiate Content-Encoding, but we can precompress objects and unconditionally set the Content-Encoding header. This works for browsers, which always set Accept-Encoding: gzip, but causes problems for curl (without --compressed) and Python requests etc. However, our JSON is really only intended for browsers (and for synctiles itself) and we want to reduce JSON sizes before adding sparse bitmaps. Support uncompressed info.json and slide.json until existing metadata has been converted over. Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
When tiling, don't upload completely white tiles; add them to a bitmap instead. If the bitmap is non-empty, Base64-encode it and add it to info.json. Then, if a bit is set, tell OpenSeadragon the tile doesn't exist so OSD won't fetch it, using pixels from the next lower resolution instead. We can't simply omit blank tiles because OSD unavoidably logs a console message for every fetch failure. Using the bitmap also saves a round trip. Retile the demo site. Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
Member
DCO signed off ✔️All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When tiling, don't upload completely white tiles; add them to a bitmap instead. If the bitmap is non-empty, Base64-encode it and add it to
info.json. Then, if a bit is set, tell OpenSeadragon the tile doesn't exist so OSD won't fetch it, using pixels from the next lower resolution instead.We can't simply omit blank tiles because OSD unavoidably logs a console message for every fetch failure. Using the bitmap also saves a round trip.
To counter the increase in JSON sizes, gzip JSON objects in the S3 bucket. S3 can't negotiate Content-Encoding, but we can precompress objects and unconditionally set the
Content-Encodingheader. This works for browsers, which always setAccept-Encoding: gzip, but causes problems forcurl(without--compressed) and Pythonrequestsetc. However, our JSON is really only intended for browsers (and forsynctilesitself).