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.

Is there a way to request a IIIF resource via the image API, but set the tileFormat via OpenSeadragon?

See original GitHub issue

I’ve been wondering on the best way to use the tileFormat option from IIIFTileSource, with a tileSources array that just specifies IIIF endpoints.

Using the JSON response directly and including the tileFormat key in there seems to do the trick. However the output from my image server doesn’t include tileFormat as this appears to be non-standard. I do have a formats array, but the values in here don’t seem to be used (i.e. if this only contains ‘png’ it will still choose ‘jpg’).

I could request each resource outside of OpenSeadragon and append the tileFormat myself (and I suspect this will be the simplest approach), but I wondered if there’s a way I’m missing that would signal to OpenSeadragon to use a different tileFormat for all requests?

Edit: In our particular use case, we have transparency and upon reflection we’d probably like other applications which consume these resources to use png and leverage that. For that reason we’re also considering if updating the response from the image server to include tileFormat might serve our needs better.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tomcranecommented, Feb 23, 2022

preferredFormats is already supported, from the v3 work that @lutzhelm did:

            if(data.preferredFormats) {
                for (var f = 0; f < data.preferredFormats.length; f++ ) {
                    if ( OpenSeadragon.imageFormatSupported(data.preferredFormats[f]) ) {
                        data.tileFormat = data.preferredFormats[f];
                        break;
                    }
                }
            }

https://github.com/openseadragon/openseadragon/blob/master/src/iiiftilesource.js#L245

This should make OSD request tiles in the format hinted in the info.json, rather than the jpg default (unless jpg is the preferredFormat!)

This is ideal for when:

  • the publisher knows that the default jpeg is not the best format for this image
  • the publisher can intervene in the info.json generation to say so

In practice, in large scale digitisation workflows, neither of these are often true. Instead, it’s a page-generation-time decision, e.g.,

  • you know that a particular collection is line-art therefore better as pngs
  • there’s some descriptive metadata, not available to the image server, that would lead you to prefer a different format for a particular item

We had a very similar need - the preferredFormats is really useful, but we also need to hint it from the client, optionally providing it where the info.json does not have it. This isn’t the same as forcing a tileFormat, because it’s a preference - if the image service can’t supply a webp or a heif or whatever you would like, you still want OSD to request the default, or a lower-ranked preference that it does support.

It would be nice to have an easy way to insert a client-side preferredFormats list into the tileSource (the info.json data) - this could even work for pre-version-3 image services.

If you have the info.json data to hand already as the tileSource, you could just add it, but if you are passing OSD the image service URL I don’t know how best to push it in there.

0reactions
iangilmancommented, Jul 26, 2022

@altert Would that be a change to OSD? I don’t really have a sense whether it would be a good addition… How true to IIIF would it be?

@azaroth42 @tomcrane Any thoughts on this hack?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use IIIF resources and image viewers
Export: In Mirador The Manifest URL can be found by clicking the info button in Mirador and scrolling to the bottom of the...
Read more >
Source: openseadragon.js
The overlays added via this option and later removed with * {@link OpenSeadragon.Viewer#removeOverlay} will be added back when a new * image ......
Read more >
modules/IiifServer/README.md · development · Jaime L Magiera ...
This new version is working, but requires the module Image Server. ... Using a third-party IIIF Image server via the Omeka media type...
Read more >
README.md - Daniel-KM / Omeka-S-module-IiifServer - GitLab
IIIF Server is a module for Omeka S that adds the IIIF specifications to serve any images and medias.
Read more >
Newest 'iiif' Questions - Stack Overflow
Questions tagged [iiif]. Ask Question. The International Image Interoperability Framework is a set of APIs developed to make it easier to support ...
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