Skip to content

demo: make a bitmap of blank tiles instead of uploading them#144

Merged
bgilbert merged 3 commits into
openslide:mainfrom
bgilbert:demo
Jun 21, 2026
Merged

demo: make a bitmap of blank tiles instead of uploading them#144
bgilbert merged 3 commits into
openslide:mainfrom
bgilbert:demo

Conversation

@bgilbert

Copy link
Copy Markdown
Member

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-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).

bgilbert added 3 commits June 20, 2026 10:24
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>
@openslide-bot

Copy link
Copy Markdown
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.

@bgilbert bgilbert merged commit 7bc1134 into openslide:main Jun 21, 2026
2 checks passed
@bgilbert bgilbert deleted the demo branch June 21, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants