-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page count for TIF/PDF in request for info.json #344
Comments
Hi @barser, Most of the information in info.json is page-specific. Different pages may have different dimensions, tile sizes, etc. So, adding a I think it would be OK to add the page count to the delegate object context. You could then expose it in info.json using the For a more correct solution, maybe Cantaloupe could do something like what it does with scale constraints and recognize a special suffix on the identifier to indicate a page number, instead of using a But what does a client do with I would be interested to know if IIIF has offered guidance on this use case. I encourage you and others with the same use case to voice it to the designers of the Image API. |
In IIIF 3.0 there is a |
@adolski since we assume Cantaloupe deals with only the Image API, which is great and more than good enough. So for the PDF use case (and the cool fact we can request pages for PDFs via this server) we use |
Hi @adolski,
It would be very useful! Moreover, such compound identifier will not violate the IIIF Image API identifier specification unlike the If I place link But if the link to the page |
Hi @DiegoPino,
Could you share example of your Presentation API manifest please? When I create manifest with page numbers as GET parameters, then viewers can't correctly process the links - see example in this post. |
@mitring I'm not skilled as @DiegoPino is but probably our Archipelago presentation API works due to including into resource id the page number GET as this: "canvases": [
{
"@id": "http://archipelago.byterfly.eu/node/29/iiif/b14b588e-c335-4df7-ae6d-3ba2a831c714/canvas/p1",
"@type": "sc:Canvas",
"label": "p. 1",
"width": 3,
"height": 4,
"images": [{
"@type": "oa:Annotation",
"motivation": "sc:painting",
"resource":{
"@id": "http://archipelago.byterfly.eu/iiif-server/iiif/2/9d8%2Fapplication-conf16-selectedpapers-11-ceregato-et-al-b14b588e-c335-4df7-ae6d-3ba2a831c714.pdf/full/full/0/default.jpg?page=1",
"@type": "dctypes:Image",
"format": "image/jpeg", |
Hi @giancarlobi, Thank you for your reply! But in your example you specify link to concrete full-size image in
And in such case |
@mitring you are right, maybe @DiegoPino has some more notes to add. IMHO I think that your idea for a suffix style {id}page{n} would be very useful as also @adolski reported in his post. |
@mitring sorry, late to the party here. Time zone difference! As @giancarlobi correctly was saying, we do generate the IIIF manifests for PDFs via this property but as you have clearly detected too, API Specs on one side but also each pretty liberal interpretation of each on the client side (or viewers) make this quite complex to process. I can not remember where in the specs (if you can point me to it it would be great), it says that URL arguments are not allowed. I was in the impression that given the original nature of the manifests (in v 2.x it was clearly JSON-LD, now in 3.0 more a 'depends on you how to interpret it, pure json or not), anything For that reason and others (client, viewers, each one doing things differently) we decided to build different type of dynamic generated iiif manifests (v 3) depending on the need and in specific, the PDF one that uses the page arguments is serving images directly without a service definition to avoid this whole problem, so still spec compliant but yes, no black and white or rotation possible. But, that said, we have another ongoing discussion with some boiler plate code that is specific to our needs but can be applied to any local solution really. An URL wrapper logic around this to make API client happy and of course also Cantaloupe. Basically we (i) have planned for a few proxy endpoint/URLS that wrap cantaloupe ones and do exactly what @adolski suggests, move arguments into IDs, and then locally those are split,processed and internal call to cantaloupe is made and the resulting JSON altered to get a correct, capable for your need, info.json. I know it sounds like a hack, but on the other side gives (or said different would give when done) it allows us to have more control over this and other arguments we could need to pass into the ID. I feel a good way of doing almost the same directly on cantaloupe if you don't want to have your own proxy pre processing of cantaloupe endpoints would be to allow in cantaloupe a request preprocessor using the same delegates system/ruby processing a way of processing/splitting ids before the actual call is made and allowing then from inside the delegate call then cantaloupe again. Not sure if i explain myself, like a pre handler for the request. That way the id and how its formed (with an extra Side note: i feel there is a larger issue in how the specs expect propertoes like size (with/height) to be always there v/s the fact that they also depend on the info.json/service, given the fact that the later can provide those/proportions. That already makes our dynamic IIIF manifest generation quite processing heavy and myself not happy. |
Hi @DiegoPino, Thanks for your detailed answer! Here is my "five pennies" on some statements.
There is no strict prohibition, but it's clear from the context of Chapter 2 of IIIF Image API. Here are some examples:
So there is simply no place for GET parameters, and URI like
Yes, I also noticed that the
I am also working in this direction now, trying to setup URL rewriting on Nginx that proxies requests to Cantaloupe. But you are right, this is a hack :)
I got the idea, thank you. It sounds cool, moreover - we already have something like that: |
Hi @mitring, thanks. Yes its pretty much the same use case we have. I feel this statement here, which is the one that really is complicating the issue, is wrong in terms of how and URI, arguments and protocol work (RFC specs):
My take is that
Yes. I agree. I wish there could be other options, but could be complex to enforce in simple code implementations (where calling a URI excels). Like, Instead of using get arguments we could use HTTP HEADERS but then there is no way you can pass headers from a Manifest! Another issues of just a URI based document which also means we need to be able to use GET. We have use headers many times when needing backend authentication to retrieve images from its source but never from inside a manifest of course. My conclusion is: its a little bit complex to demand this change here and not even sure i could make a point (like asking please!) without also asking Client writers/viewer implementers and IIIF API specs committee to clarify what space GET has in their API. |
Doing a little research into this particular issue. If I may, I would like to suggest following the kind of naming convention defined for URN: https://en.wikipedia.org/wiki/Uniform_Resource_Name It is defined as Thoughts? |
My solution was to use Level0 support in viewer (Mirador3 in my case). {
"@id": "https:\/\/my.server\/ein3ft\/ri-138226\/canvas-st16410385-page-3",
"@type": "sc:Canvas",
"height": 1600,
"width": 1600,
"label": "compressed.tracemonkey-pldi-09.pdf",
"thumbnail": {
"@id": "https:\/\/my.server\/image416\/iiif\/2\/fgfg5h4f%2Fmain%2Fr%2Fop%2F71u%2Frop71u2n42gj.pdf\/full\/,100\/0\/default.jpg?page=3"
},
"images": [
{
"@type": "oa:Annotation",
"motivation": "sc:painting",
"on": "https:\/\/my.server\/ein3ft\/ri-138226\/canvas-st16410385-page-3",
"resource": {
"@id": "https:\/\/my.server\/image416\/iiif\/2\/fgfg5h4f%2Fmain%2Fr%2Fop%2F71u%2Frop71u2n42gj.pdf\/full\/full\/0\/default.jpg?page=3",
"@type": "dctypes:Image",
"format": "pdf",
"height": 1600,
"width": 1600
}
}
]
} |
I'm tinkering with something for this in my fork that will allow a user to set a property called
And you would reference page numbers in a PDF via this format: If you leave the property in cantaloupe.properties blank, it works just as it does today with I still have some test failures to work through and I want to be able to test more different scenarios but I think it will work. I based most of the code on the ScaleConstraint code which works pretty much the same. It should work just fine with both settings. |
@cmhdave, it looks like we started working on this around the same time. 😄 The identifier path component needs to support three things, currently: an identifier, a page number, and/or a scale constraint, and the image server needs to be able to transform it not only from its component parts, but also to them (in order to support generating URIs). Version 4.1 already supports a scale constraint suffixed to an identifier. I'm thinking that I will phase out the "suffix" terminology and replace it with the concept of a "meta-identifier" which consists of those components. So, it can be said that the "identifier path component" may contain either an identifier or a meta-identifier. As for how a meta-identifier is formatted, there are two main options, configurable via a
That is the meat of it, I think. I'm open to feedback on this approach. I tried to come up with a solution that is simple out-of-the-box but offers precise control when needed. |
I'm honestly happy that you are tackling this @adolski. Even though what I have is working I wasn't confident that I didn't break anything with the scale constraint. (The tests I wrote with the different variations passed but who knows what I might have broken in a live environment). That and I couldn't shake the feeling that the way I was doing it was kind of "hacky" and yours sounds like a more robust solution. I look forward to trying yours out! |
The meta-identifier feature is on No worries @cmhdave, I felt the same way as I was working on this. The "scale constraint suffix" stuff was hacky to begin with. Hopefully what's in place now is a little bit better. Also, in the end, it was a lot more work than I thought it would be. |
This thread was originally talking about a page count in information responses. I don't want to add that by default, but there is now a I'm going to close this issue as I think it's done now, more or less, but feel free to reopen if you find otherwise. |
Hello, team!
Please consider adding additional section into info.json with page count for multi-page formats such as TIF/PDF.
I believe it could be very useful in some scenarios.
Thank you!
The text was updated successfully, but these errors were encountered: