IIIF-Commons / thumbnail-panel

https://thumbnail-panel.netlify.app
MIT License
3 stars 1 forks source link

Thumbnail without sizes array #1

Open glenrobson opened 1 year ago

glenrobson commented 1 year ago

Given the following info.json:

{
  "@context": "http://iiif.io/api/image/3/context.json",
  "id": "https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon",
  "type": "ImageService3",
  "width": 2315,
  "height": 3000,
  "profile": "level1",
  "protocol": "http://iiif.io/api/image",
  "tiles": [{
      "width": 512,
      "height": 512,
      "scaleFactors": [1, 2, 4]
  }],
  "extraFormats": ["jpg", "png"],
  "extraQualities": ["default", "color", "gray"],
}

and the desire to have a thumbnail 500px wide. What URL should we request?

This assumes the following:

Option 1 Use the tile width to select the size closest but bigger to what we want:

https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon/full/512,/0/default.jpg

Option 2 Use the scale factors to determine the different sizes available:

ScaleFactor 4:

Width / 4 = 2315 / 4 = int(578.75)

ScaleFactor 2:

Width / 2 = 2315 / 2 = int(1157.5)

https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon/full/578,/0/default.jpg

Option 3 There isn't enough information in the info.json to tell which is the fastest image so just request the one you want:

https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon/full/500,/0/default.jpg

glenrobson commented 1 year ago

Responses in SLACK: https://iiif.slack.com/archives/C18FHBKAQ/p1674555562882179

Andrew: "Extracting at tile boundaries will probably be the most efficient. I seem to remember somewhere in some discussion that resizing down to the closest power of 2 is also more efficient for IIP, but I could also be imagining this?"

Ruven: "And, yes, powers of 2 are better (you are not imagining things!) because the resolutions levels for both TIFF and JPEG2000 are set at powers of 2"

Ruven: "Going back to glen.robson's question, I would imagine it would be best to use scaleFactors to get the fastest image as these sizes should correspond to any existing resolution levels in the image"

Robert: "Yes, at least in digilib we look at the existing precomputed thumbnails and pyramid TIFF sizes and output sizes and tiles which can be served the fastest."