Skip to content

Unable to pass @id to IIIF layout #2612

@edsilv

Description

@edsilv

I'm using v0.27.2

When callng .tile passing the iiif layout, the resulting info.json does not have the correct @id.

sharp(image)
    .tile({
      layout: "iiif",
      id: "https://test.com"
    })
    .toFile(directory, (err, _info) => {
      resolve();
    }); 

This should result in:

{
  "@context": "http://iiif.io/api/image/2/context.json",
  "@id": "https://test.com/directory",

But it still uses the default example.com id:

{
  "@context": "http://iiif.io/api/image/2/context.json",
  "@id": "https://example.com/directory",

Ostensibly, the passed id should be used here in libvips: https://github.com/libvips/libvips/blob/master/libvips/foreign/dzsave.c#L1006

The id option appears to be missing here: https://github.com/lovell/sharp/blob/master/lib/output.js#L713

However, when I add:

    if (is.defined(options.id)) {
      if (is.string(options.id)) {
        this.options.id = options.id;
      } else {
        throw is.invalidParameterError('id', 'not a string', options.id);
      }
    }

in my local copy of Sharp, it's not making any difference to the outputted info.json...

What is the output of running npx envinfo --binaries --system?

  System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
    Memory: 4.28 GB / 15.83 GB
  Binaries:
    Node: 14.15.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.5.1 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions