Documentation
Source Images
Image Metadata

The create-metadata script can probe one or more image files and set the appropriate width, height, pages, and tile size metadata. It can be invoked three different ways:

Standalone Script Invocation

Prerequisites

Step 1

Make sure the AWS CLI is properly configured (opens in a new tab) with credentials that have read/write access to the S3 bucket containing the images that will be served by serverless-iiif

Step 2

Clone the serverless-iiif repository (opens in a new tab).

Step 3

Install runtime dependencies:

npm ci

Step 4

Run the script:

export sourceBucket="my-image-bucket" # corresponds to the SourceBucket deploy parameter
export resolverTemplate="%s.tif" # corresponds to the ResolverTemplate deploy parameter
npm run create-metadata image_id_1 image_id_2 image_id_3

Or to process every file in the bucket, regardless of type:

export sourceBucket="my-image-bucket"
export resolverTemplate="%s"
aws s3 ls --recursive s3://my-image-bucket/ \
  | awk '{ print $4 }' \
  | xargs -n 50 npm run create-metadata

Step 5

Verify the output:

aws s3api head-object --bucket my-image-bucket --key image_id_1.tif

Lambbda Function Invocation

Prerequisites

  • A serverless-iiif application stack deployed with CreateMetadataFunction set to true

Step 1

Get the value of the MetadataFunctionARN output from the deployed stack.

Step 2

Determine the ID of the image (as it will look in the ID part of the IIIF URL).

Step 3

Invoke the Lambda Function (opens in a new tab) with the payload { imageId: "ID_OF_IMAGE" }

S3 Batch Operation Invocation

Prerequisites

  • A serverless-iiif application stack deployed with CreateMetadataFunction set to true

Step 1

Get the value of the MetadataFunctionARN output from the deployed stack.

Step 2

Create an S3 Batch Operation (opens in a new tab) specifying the MetadataFunctionARN as the operation. The manifest must only include objects from the image source bucket, as that is the only bucket the Lambda Function has access to.