|
1 |
| -#IIIF-Image-API |
| 1 | +#Introduction |
| 2 | +This documents how to retrieve images fromhttps://emunch.emuseum.no using the IIIF Image and Presentation APIs. The base URI (`{scheme}://{server}{/prefix}/{identifier}`) for the API is`https://munch.emuseum.com/apis/iiif/image/v2/{identifier}`. The identifier is the media ID. The media ID can be found in an image's URL. This URL can be requested from the eMuseum API using something like this:`GET https://munch.emuseum.com/objects/json?mediaExistence=True&key={key}`. In the response look for`primaryMedia`: |
| 3 | + |
| 4 | +``` |
| 5 | +"primaryMedia": { |
| 6 | +"value": "/internal/media/dispatcher/7483/resize%25253Aformat%25253Dthumbnail;jsessionid=54EDD47D73197613988875184D91DAC7" |
| 7 | +} |
| 8 | +``` |
| 9 | +The media ID is the number after```dispatcher/```. |
| 10 | + |
| 11 | +#Image request URI syntax |
| 12 | +The syntax for requesting an image is```{scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}```. |
| 13 | + |
| 14 | +#Image information request URI syntax |
| 15 | +The syntax for requesting information about an image is```{scheme}://{server}{/prefix}/{identifier}/info.json```. |
| 16 | + |
| 17 | +#Image request parameters |
| 18 | +##Region |
| 19 | +The region parameter defines the rectangular portion of the full image to be returned. Region can be specified by pixel coordinates, percentage or by the value “full”, which specifies that the entire image should be returned. |
| 20 | + |
| 21 | +| Form| Description| |
| 22 | +| ---| ---| |
| 23 | +| full| The complete image is returned, without any cropping.| |
| 24 | +| square| The region is defined as an area where the width and height are both equal to the length of the shorter dimension of the complete image. The region may be positioned anywhere in the longer dimension of the image content at the server’s discretion, and centered is often a reasonable default.| |
| 25 | +| x,y,w,h | The region of the full image to be returned is specified in terms of absolute pixel values. The value of x represents the number of pixels from the 0 position on the horizontal axis. The value of y represents the number of pixels from the 0 position on the vertical axis. Thus the x,y position 0,0 is the upper left-most pixel of the image. w represents the width of the region and h represents the height of the region in pixels. |
| 26 | +| pct:x,y,w,h| The region to be returned is specified as a sequence of percentages of the full image’s dimensions, as reported in the image information document. Thus, x represents the number of pixels from the 0 position on the horizontal axis, calculated as a percentage of the reported width. w represents the width of the region, also calculated as a percentage of the reported width. The same applies to y and h respectively. These may be floating point numbers.| |
| 27 | + |
| 28 | +The```square``` form is not implemented in this API. |
| 29 | + |
| 30 | +##Size |
| 31 | +The size parameter determines the dimensions to which the extracted region is to be scaled. |
| 32 | + |
| 33 | +| Form| Description| |
| 34 | +| ---| ---| |
| 35 | +| full| The image or region is not scaled, and is returned at its full size. Note[deprecation warning][1]| |
| 36 | +| max| The image or region is returned at the maximum size available, as indicated by maxWidth, maxHeight, maxArea in the profile description. This is the same as full if none of these properties are provided.| |
| 37 | +| w,| The image or region should be scaled so that its width is exactly equal to w, and the height will be a calculated value that maintains the aspect ratio of the extracted region.| |
| 38 | +| ,h| The image or region should be scaled so that its height is exactly equal to h, and the width will be a calculated value that maintains the aspect ratio of the extracted region.| |
| 39 | +| pct:n| The width and height of the returned image is scaled to n% of the width and height of the extracted region. The aspect ratio of the returned image is the same as that of the extracted region.| |
| 40 | +| w,h| The width and height of the returned image are exactly w and h. The aspect ratio of the returned image may be different than the extracted region, resulting in a distorted image.| |
| 41 | +| !w,h| The image content is scaled for the best fit such that the resulting width and height are less than or equal to the requested width and height. The exact scaling may be determined by the service provider, based on characteristics including image quality and system performance. The dimensions of the returned image content are calculated to maintain the aspect ratio of the extracted region.| |
| 42 | + |
| 43 | +##Rotation |
| 44 | +The rotation parameter specifies mirroring and rotation. A leading exclamation mark (“!”) indicates that the image should be mirrored by reflection on the vertical axis before any rotation is applied. The numerical value represents the number of degrees of clockwise rotation, and may be any floating point number from 0 to 360. |
| 45 | + |
| 46 | +| Form| Description| |
| 47 | +| ---| ---| |
| 48 | +| n| The degrees of clockwise rotation from 0 up to 360.| |
| 49 | +| !n| The image should be mirrored and then rotated as above.| |
| 50 | + |
| 51 | +This API only allows the values```0```,```90```,```180```,```270``` and```360```. Mirroring is not implemented. |
| 52 | + |
| 53 | +##Quality |
| 54 | +The quality parameter determines whether the image is delivered in color, grayscale or black and white. |
| 55 | + |
| 56 | +| Quality| Parameter Returned| |
| 57 | +| ---| ---| |
| 58 | +| color| The image is returned in full color.| |
| 59 | +| gray| The image is returned in grayscale, where each pixel is black, white or any shade of gray in between.| |
| 60 | +| bitonal| The image returned is bitonal, where each pixel is either black or white.| |
| 61 | +| default| The image is returned using the server’s default quality (e.g. color, gray or bitonal) for the image.| |
| 62 | + |
| 63 | +##Format |
| 64 | +The format of the returned image is expressed as an extension at the end of the URI. |
| 65 | + |
| 66 | +| Extension| MIME Type| |
| 67 | +| ---| ---| |
| 68 | +| jpg| image/jpeg| |
| 69 | +| tif| image/tiff| |
| 70 | +| png| image/png| |
| 71 | +| gif| image/gif| |
| 72 | +| jp2| image/jp2| |
| 73 | +| pdf| application/pdf| |
| 74 | +| webp| image/webp| |
| 75 | + |
| 76 | +Only```jpg```and```png```are implemented. All other values are invalid. |
| 77 | + |
| 78 | +#Full documentation |
| 79 | +See[IIIF Image API 2.1.1][2] and[IIIF Presentation API 2.1.1][3] for full documentation. |
| 80 | + |
| 81 | +[1]:https://iiif.io/api/image/2.1/#full-dep"Deprecation Warning" |
| 82 | +[2]:https://iiif.io/api/image/2.1/"IIIF Image API" |
| 83 | +[3]:https://iiif.io/api/presentation/2.1/"IIIF Presentation API" |