Skip to content

Annotation builder #11

@stephenwf

Description

@stephenwf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions