Skip to content

Usage example for the custom YAML dezoomer

Ophir LOJKINE edited this page Sep 13, 2020 · 21 revisions

This page describes how to use the tool, following a concrete example.

Stage 1: Find the meta-information associated to your zoomable image

Here is the information we need to find:

  • the high-resolution image dimensions (width and height in pixels)
  • the dimensions of the small image tiles (width and height in pixels)

There are several methods for this, depending on the zoomable image service. For the image size, you can try to look for it in the image source, in the resources the page loads, or try to guess, starting with a small value. For the tile sizes, you can use your browser's network monitor to find the tiles, and check their size.

Stage 2: construct the URL template

Here, you need to find the URL format for the tiles. You have to locate the tiles in the network monitor, and copy their URLs. You will probably find out that all tiles have similar URLs, with only a few parameters that change. You will need to guess which parameters represent the x and y position of the tile.

For instance, if our tiles have the following URLs :

http://example.com/my_image/0/0.jpg
http://example.com/my_image/0/1.jpg
...
http://example.com/my_image/12/89.jpg

and the URL template to use is

http://example.com/my_image/{{x}}/{{y}}.jpg

Stage 3: create a tiles.yaml file

We start by copy-pasting the example.yaml file, and then we modify it:

  • We set url_template to the url pattern we found in step 2
  • We set the variables according to what we got in step 1
  • We set Referer to the URL of the initial web page on which we found the zoomable image.
  • If we don't have an x and y variables, we use x_template and y_template to specify how to compute the x and y position of each tile.

Examples

tile number by axis in the URL

url_template: "http://example.com/my_image/{{x}}/{{y}}.jpg"
x_template: "x * tile_size"
y_template: "y * tile_size"
variables:
  - { name: x, from: 0, to: 12 } # Number of tiles on the x axis
  - { name: y, from: 0, to: 89 } # Number of tiles on the y axis
  - { name: tile_size, value: 256 }
headers:
  Referer: "http://example.com/"

Tile coordinates in pixels in the URL

url_template: "http://example.com/view.php?img=my_image&x={{x}}&y={{y}}&size=256"
variables:
  - { name: x, from: 0, to: 1200, step: 256 } # Image width, in pixels
  - { name: x, from: 0, to: 850, step: 256 } # Image height, in pixels

Tile index in the url

url_template: "http://example.com/my_image/{{i}}.jpg"
x_template: "i % horizontal_tiles"
y_template: "i / horizontal_tiles"
variables:
  - { name: i, from: 0, to: 1200 } # Total number of tiles
  - { name: horizontal_tiles, value: 60 } # Number of tiles on the x axis

Stage 4: launch dezoomify-rs

Open a terminal and launch:

dezoomify-rs tiles.yaml result.jpg

Where:

  • dezoomify-rs is the path to which you downloaded the executable file for your platform,
  • tiles.yaml is the path to which you saved the file created in the previous step.
  • result.jpg is the path to the image file you want to create.

Then just wait for the program to finish (this can take some time if the number of tiles to download is large), and open result.jpg: your image should be there !

Clone this wiki locally