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
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -645,9 +645,9 @@ 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.
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. Note that the rounding method is implementation dependent.
649
649
650
-
```python
650
+
{% highlight python %}
651
651
# Calculate region parameters /xr,yr,wr,hr/
652
652
xr = n * tw * s
653
653
yr = m * th * s
@@ -658,17 +658,23 @@ Early sanity checking of URIs (lengths, trailing GET, invalid characters, out-of
658
658
if (yr + hr > height):
659
659
hr = height - yr
660
660
# Calculate size parameters /ws,hs/
661
-
s2 = s/2# use to implement rounding with integer arithmetic
662
661
ws = tw
663
662
if (xr + tw*s > width):
664
-
ws = (width - xr +s2) / s
663
+
ws = (width - xr + s - 1) / s # +s-1 in numerator to round up
665
664
hs = th
666
665
if (yr + th*s > height):
667
-
hs = (height - yr +s2) / s
668
-
```
666
+
hs = (height - yr + s - 1) / s
667
+
{% endhighlight %}
669
668
{: .urltemplate}
670
669
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.
670
+
* 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 image returned. A formula for calculating the dimensions of the image returned for a given starting size and rotation is given below. Note that the rounding method is implementation dependent and that some languages require conversion of the angle from degrees to radians.
0 commit comments