Viewers
IIPImage is a client / server system. The IIPImage server streams images to the client application, typically embedded within a web page. There are several clients to choose from, including the JavaScript viewers OpenSeadragon and IIPMooViewer . Alternatively, images can be dynamically resized, cropped and exported.
OpenSeadragon
OpenSeadragon is an open-source JavaScript viewer with built-in support for the IIP protocol from version 6.0.0 onwards. It is a good choice for new projects, and it also supports IIIF, DeepZoom and Zoomify. See the OpenSeadragon IIP tile source documentation for the full set of options.
Include OpenSeadragon on your page, add a container for the viewer, and configure an IIP tile source with the URL of your iipsrv endpoint and the path of the image on the server:
<div id="viewer" style="width: 800px; height: 600px;"></div>
<script src="https://cdn.jsdelivr.net/npm/openseadragon@6.1.1/build/openseadragon/openseadragon.min.js"></script>
<script>
OpenSeadragon({
id: "viewer",
tileSources: {
iipsrv: "/fcgi-bin/iipsrv.fcgi",
image: "test.tif"
}
});
</script>
The iipsrv parameter is the URL of the server’s FastCGI endpoint (or just /iiif/ if you use URI mapping) and image is the image path on the server. If OpenSeadragon is hosted on a different domain to iipsrv, enable CORS on the image server — see the server configuration
. Optional tile source parameters include format (e.g. jpg, webp, png, avif) and transform for server-side image processing.
IIPMooViewer
IIPMooViewer is a high performance Mootools based Ajax Javascript client. See the IIPMooViewer page for more details.
Dynamic Image Export
It is also possible to dynamically export resized or cropped versions of image by using parameters in your URL with the IIP protocol
CVT=JPEG. JPEG images can be instantly generated for any region within the image at the requested size. This is useful for many purposes, such as generating low resolution views or thumbnails of high resolution content and could also be used to create responsive images
.
The FIF=image command specifies the absolute path to the image on the server machine and WID=width or HEI=height specify the width or height respectively. In the following example, a JPEG image of 400 pixels in width is generated from a source TIFF image located at /tmp/test.tif on the IIP server machine (note that CVT=jpeg must always be the final parameter):
<img src="/fcgi-bin/iipsrv.fcgi?FIF=/tmp/test.tif&WID=400&CVT=jpeg" />
If both WID and HEI are specified, the output image will maintain aspect ratio and fit the image within the box defined by the given width and height. This dynamic resizing can also be used for responsive images.
As well as specifying the size directly within the URL, forms can be used to give the user some choice over the final image size and JPEG quality. In this case, simply create form inputs with the values for FIF, WID, QLT and CVT. For example:
<form action="/fcgi-bin/iipsrv.fcgi" method="get">
<input type="hidden" name="FIF" value="/tmp/test.tif" />
<input type="text" name="WID" />
<input type="text" name="QLT" />
<input type="hidden" name="CVT" value="JPEG" />
</form>
To specify a particular region, use the RGN=left,top,width,height command where the left,top,width and height are defined as floating point numbers between 0 and 1. So, if you want the image to be the middle 50% of the image, use:
<img src="/fcgi-bin/iipsrv.fcgi?FIF=/tmp/test.tif&RGN=0.25,0.25,0.5,0.5&CVT=jpeg" />
3rd Party Viewers
The IIPImage server can also be used with a number of other 3rd party viewers. The server can be used with any viewer that supports either the IIIF, Zoomify or DeepZoom protocols.
For IIIF-based clients, use an image path of the form (and see this blog post for more information on IIIF use):
/fcgi-bin/iipsrv.fcgi?IIIF=/your/image/path.tif
For Zoomify-based clients, use an image path of the form:
/fcgi-bin/iipsrv.fcgi?Zoomify=/your/image/path.tif
For DeepZoom, add a .dzi suffix to the path name:
/fcgi-bin/iipsrv.fcgi?DeepZoom=/your/image/path.tif.dzi