iipsrv icon indicating copy to clipboard operation
iipsrv copied to clipboard

feature suggestion: per image MAX_LAYERS

Open zabak opened this issue 1 year ago • 11 comments

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.

zabak avatar Nov 20 '22 00:11 zabak

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.

ruven avatar Nov 20 '22 20:11 ruven

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.

zabak avatar Nov 20 '22 21:11 zabak

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.

ruven avatar Nov 21 '22 10:11 ruven

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.

zabak avatar Nov 21 '22 18:11 zabak

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

ruven avatar Nov 21 '22 20:11 ruven

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

zabak avatar Nov 21 '22 20:11 zabak

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

ruven avatar Nov 24 '22 10:11 ruven

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

zabak avatar Nov 24 '22 14:11 zabak

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.

nicolasfranck avatar Jan 24 '23 14:01 nicolasfranck

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

zabak avatar Jan 24 '23 17:01 zabak

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.

ruven avatar Jan 24 '23 22:01 ruven