Skip to content
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

Annotation builder #11

Open
stephenwf opened this issue Nov 3, 2022 · 0 comments
Open

Annotation builder #11

stephenwf opened this issue Nov 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@stephenwf
Copy link
Member

Currently there is no Annotation builder, you have to provide the JSON for each annotation individually.

I don't think a builder in the style of the Canvas or Manifest builders would for this case - instead maybe a set of presets.

Annotation.imageWithService(
  'https://example.org/image.jpg',
  { service: 'https://example.org/image.jpg/info.json' }
);

What would be nice is to include some of the analysis work done in Manifest editor. Where you can provide just an Image URL or Image service and it will figure out what the ID and inline service block should look like. This would be async and would be opt-in (with an await).

For example, the following URL:

https://iiif.wellcomecollection.org/image/b18035723_0004.JP2/full/732,1024/0/default.jpg

Might return:

{
  "id": "https://example.org/canvas/354e4ae3-d4bc-4785-b567-77dfd65bf9f8/painting",
  "type": "Annotation",
  "motivation": "painting",
  "target": "https://example.org/canvas/354e4ae3-d4bc-4785-b567-77dfd65bf9f8",
  "body": {
    "id": "https://example.org/image/4d0f3a1d-1170-42ed-81cd-49099be604f3",
    "type": "Image",
    "format": "image/jpg",
    "height": 3372,
    "width": 2411,
    "service": [
      {
        "@context": "http://iiif.io/api/image/2/context.json",
        "@id": "https://iiif.wellcomecollection.org/image/b18035723_0004.JP2",
        "protocol": "http://iiif.io/api/image",
        "width": 2411,
        "height": 3372,
        "tiles": [
          {
            "width": 256,
            "height": 256,
            "scaleFactors": [
              1,
              2,
              4,
              8,
              16
            ]
          }
        ],
        "sizes": [
          {
            "width": 715,
            "height": 1000
          },
          {
            "width": 286,
            "height": 400
          },
          {
            "width": 143,
            "height": 200
          },
          {
            "width": 72,
            "height": 100
          }
        ],
        "profile": [
          "http://iiif.io/api/image/2/level1.json",
          {
            "formats": [
              "jpg"
            ],
            "qualities": [
              "native",
              "color",
              "gray"
            ],
            "supports": [
              "regionByPct",
              "sizeByForcedWh",
              "sizeByWh",
              "sizeAboveFull",
              "rotationBy90s",
              "mirroring",
              "gray"
            ]
          }
        ],
        "type": "ImageService"
      }
    ]
  }
}

Extra configuration could limit how much of the resolved service is inlined.

Other helpers for common types of annotations could then be created.

@stephenwf stephenwf added the enhancement New feature or request label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant