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:
/identifier/region/size/rotation/quality(.format)?
and a bit of metadata about them:
/identifier/info(.(xml)|(json))?
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.
identifier | region | size | rotation | quality
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.
e.g.:
/fs/path/region/size/rotation/quality(.format)?
/fs/path/info(.(xml)|(json))?
Get the full image /full/full/0/native.jpg
Region can be specified by pixel or percent:
/930,1450,800,700/full/0/native.jpg
Again as percent:
/930,1450,800,700/pct:50/0/native.jpg
or pixel (w,, w,h, or ,h):
/930,1450,800,700/120,/0/native.jpg
Multiples of 90.
Can be native, color, grey or bitonal. Which are available (color or not) is available from info service.
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 png: /full/120,/0/native.png
Use the default: /full/120,/0/native
Use Conneg:
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.
- Bad ID
- Bad Region
- etc.
Obviously you get a 4xx/5xx as well.
Not much until last week! Chris Thatcher / OpenSeadragon Just added support for IIIF syntax.