lovasoa / dezoomify-rs

Zoomable image downloader for Google Arts & Culture, Zoomify, IIIF, and others
https://dezoomify-rs.ophir.dev
GNU General Public License v3.0
723 stars 65 forks source link

Issues with "variable" tile size (collection.barnesfoundation.org) #114

Closed yjml closed 3 years ago

yjml commented 3 years ago

I'm able to create partial stitchs of the images from
https://collection.barnesfoundation.org/
e.g. https://collection.barnesfoundation.org/objects/6312/Two-Women-by-the-Shore-Mediterranean/ using the following yaml:

url_template: "https://d2r83x5xt28klo.cloudfront.net/tiles/6312/{{x}},{{y}},256,256/256,/0/color.jpg"
variables:
  - { name: x, from: 0, to: 6656, step: 256 }
  - { name: y, from: 0, to: 4608, step: 256 }
headers:
  referer: "https://collection.barnesfoundation.org/objects/6312/Two-Women-by-the-Shore-Mediterranean/"

However, as noted, these are partial images because apparently the bottom and right side tiles (and their URLs) are sized differently (in the example case, the lower right corner would be 232x239 with URL https://d2r83x5xt28klo.cloudfront.net/tiles/6312/6656,4608,232,239/232,/0/color.jpg )

lovasoa commented 3 years ago

It looks like you are tryng to download an IIIF image using the custom yaml dezoomer. dezoomify-rs has a dezoomer that supports IIIF directly. In your case, the IIIF meta-information file is at

https://d2r83x5xt28klo.cloudfront.net/tiles/6312/info.json

Unfortunately, the file they provide is completely wrong, you will have to update it to reflect the capabilities of the server :

{
  "@context": "http://iiif.io/api/image/2/context.json",
  "@id": "https://d2r83x5xt28klo.cloudfront.net/tiles/6312",
  "@type": "iiif:Image",
  "protocol": "http://iiif.io/api/image",
  "width": 6888,
  "height": 4847,
  "tiles": [
    {
      "width": 256,
      "scaleFactors": [
        1
      ]
    }
  ],
  "profile": [
    {
      "formats": [
        "jpg",
        "png"
      ],
      "qualities": [
        "color"
      ],
      "supports": [
        "regionByPx",
        "sizeByW"
      ]
    }
  ]
}

Using a predefined dezoomer is more performant and often easier than creating your own tiles.yaml.

pic

lovasoa commented 3 years ago

Here is the diff between the old json and the one that is fixed to reflect the actual capabilities of the server:

3c3
<   "@id": "http://localhost:8080/6312",
---
>   "@id": "https://d2r83x5xt28klo.cloudfront.net/tiles/6312",
7a8
>   "tiles": [{ "width": 256, "scaleFactors": [1] }],
9d9
<     "http://iiif.io/api/image/2/level2.json",
16,18c16
<         "default",
<         "color",
<         "bitonal"
---
>         "color"
21d18
<         "full",
23,40c20
<         "regionByPct",
<         "regionSquare",
<         "sizeByDistortedWh",
<         "sizeByWh",
<         "full",
<         "max",
<         "sizeByW",
<         "sizeByH",
<         "sizeByPct",
<         "sizeByConfinedWh",
<         "mirroring",
<         "noAutoRotate",
<         "none",
<         "rotationBy90s",
<         "rotationArbitrary",
<         "baseUriRedirect",
<         "cors",
<         "jsonldMediaType"
---
>         "sizeByW"
yjml commented 3 years ago

Thanks for the info. Apart from the incorrect metadata, I presume the extension misses the file it since it's a from different URL than the main page?

lovasoa commented 3 years ago

I'm not sure what you mean. dezoomify-extension does find the URL :

image

yjml commented 3 years ago

Browser issue then?

It's not being picked up in Chrome Edge 88.0.705.68 image or Vivaldi 3.5.2115.81 (also Chrome based) image

EDIT: Yes, Firefox picks it up correctly.

Probably this https://github.com/lovasoa/dezoomify-extension/issues/12

lovasoa commented 3 years ago

Yes, if we want to keep the current permission model, then the extension cannot view requests made to other domains than the one from which you activated the extension.

We could request access to all domains all of the time, but this would make chrome display a scary warning on installation, and trigger a deep inspection from google on each update, which would make the process even slower than it is normally.

In the meantime, just use firefox, it's a great browser made by a nonprofit that cares about your privacy, as opposed to chrome (and Edge).