Loris is an Implementation of the IIIF (International Image Interoperability Framework) Image API specification. Loris is designed to work w/ JPEG2000 files, but this is not part of the spec.
IIIF defines a Syntax for accessing images:
and a bit of metadata about them:
One of the goals is to have a persistent and cool URI not just for the image but regions and other derivatives thereof, so that you can make statements about those regions or derivatives.
Loris ships w/ a simple ID resolver that just takes a slice of a filesystem path
and resolves it to a file. This is isolated in
resolver.py and is designed to be changed to suit different environments.
Get the full image /full/full/0/native.jpg
Region can be specified by pixel or percent:
Again as percent:
or pixel (
Multiples of 90.
bitonal. Which are available (color or not) is available from
Loris does jpg and png and the moment. The only feature missing from making this a IIIF level impl is that it won't return a jp2. You can define a default in config file, and use content negotiation rather than a file ext as well.
Ask for a
Use the default: /full/120,/0/native
curl -v \ -H "Accept: image/png" \ "http://lorisimg.princeton.edu/loris/pudl0001/4609321/s42/00000001/full/120,/0/native" \ -o /tmp/a.png
Basically just enough metadata to drive a UI.
Cache is built on the FS mirroring the path in the URI, so each request looks there first. We just use a cron to check that it's not bigger than we want, and clear out LRU files until the size is acceptable. A sample copy of the cron is in the code repo. It could be smarter if you needed it to be.
As expected, will send a
304 if client sends an
If-Modified-Since header (and it hasn't been).
IIIF also defines a syntax for the HTTP message body when something goes wrong.
Obviously you get a 4xx/5xx as well.