ruven / iipsrv

iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
https://iipimage.sourceforge.io
GNU General Public License v3.0
292 stars 115 forks source link

feature suggestion: per image MAX_LAYERS #246

Open zabak opened 2 years ago

zabak commented 2 years ago

Similar to #245 I have a use case for dynamically changing the MAX_LAYERS parameter per image. Most of our jpeg2000 images have 12 quality layers and it is OK to read just several of them - some of them are maps compressed losslessly so need to avoid reading all quality layers. On the other hand, in some cases we have too high lossy compression (1:30) and we need to read all quality layers to display a good image. We could use a proxy to add the correct number of layers to the request.

ruven commented 2 years ago

But how would the server know how many layers to decode for a particular image?

Don't forget, there's the existing LYR parameter. Doesn't this do what you need? For each image request, you can specify the number of quality layers to decode. For example: FIF=image.jp2&LYR=12&WID=500&CVT=jpeg will decode all 12 quality layers to create an image 500px in width.

zabak commented 2 years ago

We would have to update the metadata to let the server know. The parameter above does not work with IIIF requests which we solely use to get images from the imageserver nowadays.

ruven commented 2 years ago

We would have to update the metadata to let the server know.

So, this would be a fixed value in the JPEG2000 metadata? That's certainly possible, but the problem is that it will be limited to Kakadu as OpenJPEG currently cannot handle this kind of metadata.

zabak commented 2 years ago

Not the metadata embedded in the image. I guess we would have to update some external metadata, perhaps whatever we have in Solr. The proxy is asking for some metadata anyway, because of access rights, so there would be one more field to check. And another field for the watermarks, perhaps.

ruven commented 2 years ago

If it's not in the image metadata, how would you let iipsrv know how many layers to decode?

zabak commented 2 years ago

Because of the intermediate proxy, that checks for access rights. Users do not communicate with the imageserver directly, they go to the proxy.

ruven commented 2 years ago

OK, but how would the proxy let the image server know the number of layers to decode in that case?

zabak commented 2 years ago

I will just keep the number of layers in Solr index, probably just for the cases where I need something different from the default.

nicolasfranck commented 1 year ago

Depends on what you're using from the iipsrv. If you are using the IIIF then you are limited to the parameters that the IIIF image api standard uses (so no layers). Or you may use the FIF directly, in which case you can use that LYR parameter. Anyway, that IIIF internally uses the FIF in some way (right @ruven ?), but you will have reimplement the mapping between the standards yourself.

zabak commented 1 year ago

@nicolasfranck I am using IIIF and that is why I am looking for a solution with the proxy - I know the number of layers I want to provide for each image (and it might vary).

ruven commented 1 year ago

Anyway, that IIIF internally uses the FIF in some way

Yes, each IIIF request is directly mappable to an IIP request, so a solution would be to rewrite the requests to FIF= format and add the LYR parameter to it.