You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/api/image/2.0/index.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -474,7 +474,7 @@ The objects in the `sizes` list have the properties in the following table. Ima
474
474
|`viewing_hint`| Optional | A string giving a hint to the intended use of the size. It may have any value, but the following are recommended: `icon`, `thumbnail`, `small`, `medium`, `large`, `xlarge`|
475
475
{: .image-api-table}
476
476
477
-
The objects in the `tiles` list have the properties in the following table. The `width` and `height` should be used to fill the region parameter and the `scale_factors` to complete the size parameter of the image URL. This is described in detail in the [XXX-SIMEON-XXX][]implementation note.
477
+
The objects in the `tiles` list have the properties in the following table. The `width` and `height` should be used to fill the region parameter and the `scale_factors` to complete the size parameter of the image URL. This is described in detail in the [Implementation Notes][a-implementation-notes].
478
478
479
479
| Property | Required? | Description |
480
480
| ---------- | --------- | ----------- |
@@ -645,6 +645,29 @@ Early sanity checking of URIs (lengths, trailing GET, invalid characters, out-of
645
645
* This specification makes no assertion about the rights status of requested images or any other descriptive metadata, whether or not authentication has been accomplished. Please see the [IIIF Presentation API][prezi-api] for rights and other information.
646
646
* This API does not specify how image servers fulfill requests, what quality the returned images will have for different parameters, or how parameters may affect performance.
647
647
* Image identifiers that include the slash (/ %2F) or backslash (\ %5C) characters may cause problems with some HTTP servers. Apache servers from version 2.2.18 support the `AllowEncodedSlashes NoDecode`[configuration directive][apache-aesnd] which will correctly pass these characters to client applications without rejecting or decoding them. Servers using older versions of Apache and local identifiers which include these characters will need to use a workaround such as internally translating or escaping slash and backslash to safe value (perhaps by double URI-encoding them).
648
+
* When requesting image tiles, the [Region][region] and [Size][size] parameters must be calculated to take account of partial tiles along the right and lower edges for a full imagine that is not an exact multiple of the scaled tile size. The algorithm below is shown as Python code and assumes integer inputs and integer arithmetic throughout (ie. remainder discarded on division). Inputs are: size of full image content `(width,height)`, scale factor `s`, tile size `(tw,th)`, and tile coordinate `(n,m)` counting from `(0,0)` in the upper-left corner.
649
+
650
+
```python
651
+
# Calculate region parameters /xr,yr,wr,hr/
652
+
xr = n * tw * s
653
+
yr = m * th * s
654
+
wr = tw * s
655
+
if (xr + wr > width):
656
+
wr = width - xr
657
+
hr = th * s
658
+
if (yr + hr > height):
659
+
hr = height - yr
660
+
# Calculate size parameters /ws,hs/
661
+
s2 = s/2# use to implement rounding with integer arithmetic
662
+
ws = tw
663
+
if (xr + tw*s > width):
664
+
ws = (width - xr + s2) / s
665
+
hs = th
666
+
if (yr + th*s > height):
667
+
hs = (height - yr + s2) / s
668
+
```
669
+
{: .urltemplate}
670
+
648
671
* As described in [Rotation][rotation], in order to retain the size of the requested image contents, rotation will change the width and height dimensions of the returned image file. A formula for calculating the dimensions of the returned image file for a given rotation can be found here.
0 commit comments