gPrime is an Image Server

One of the main goals of the gPrime web-based genealogy software is to integrate it with modern tools. Of course, one requirement for any modern genealogy program is to be able to display images. This could be very simple: “show me a picture!” But, it can also be somewhat more sophisticated: “show be a particular region of a picture!” This requirement looked like a good match with the International Image Interoperability Framework Consortium’s Image API. The IIIF (pronounced “Triple-Eye-Eff”)  Image API:

“…specifies a web service that returns an image in response to a standard HTTP or HTTPS request. The URI can specify the region, size, rotation, quality characteristics and format of the requested image. A URI can also be constructed to request basic technical information about the image to support client applications. This API was conceived of to facilitate systematic reuse of image resources in digital image repositories maintained by cultural heritage organizations. It could be adopted by any image repository or service, and can be used to retrieve static images in response to a properly constructed URI.” From http://iiif.io/api/image/2.1/

A perfect match! It was fairly easy to get their Image API reference implementation to integrate with Gramps’ image region selection parameters. So, you can easily import your Gramps XML data into gPrime and immediately see the proper regions using the Image API.

For example, if you visit (username: demo, password: demo):

http://demo.gprime.info/person/AWFKQCJELLUWDY2PD3

You’ll see a small section of an image to the far right:

screenshot-from-2017-01-04-11-43-16

This image has been extracted and scaled to be exactly the right size for this page, so it isn’t wasting any bandwidth in providing an image that is bigger than necessary. You can enter the URL of that section directly using this appended to the media URL prefix:

/75,93,50,55/80,/0/default.jpg

and get exactly that region:

default

But that is only a portion of the image. To see the whole image, append /full/full/0/default.jpg onto the media URL to see the full image:

default-1

The Image API is actually a mini language for describing image processing manipulations to a picture. For example, you can alter the quality, rotate, scale, select a region, and more. Here is the syntax for the language from http://iiif.io/api/image/2.1/#uri-syntax:

{region}/{size}/{rotation}/{quality}.{format}

You can also get details about the image and the Image API using “/info.json” on the URL:

http://demo.gprime.info/imageserver/238CGQ939HG18SS5MG/info.json

That returns this JSON structure:

{
 "@context": "http://iiif.io/api/image/2/context.json", 
 "@id": "localhost:80/imageserver/238CGQ939HG18SS5MG", 
 "attribution": "Provided by Example Organization", 
 "height": 347, 
 "license": "http://license.example.com/license", 
 "logo": "http://example.com/images/logo.jpg", 
 "profile": ["http://iiif.io/api/image/2/level2.json", 
             {"formats": ["gif", "tif", "pdf"], 
              "qualities": ["color", "gray"], 
              "supports": ["regionSquare", 
                           "canonicalLinkHeader", 
                           "profileLinkHeader", 
                           "mirroring", 
                           "rotationArbitrary", 
                           "sizeAboveFull"]
             }], 
 "protocol": "http://iiif.io/api/image", 
 "sizes": [{"height": 86.75, "width": 125.0}, 
           {"height": 173.5, "width": 250.0}, 
           {"height": 347.0, "width": 500.0}], 
 "tiles": [{"scaleFactors": [1, 2, 4], "width": 512}], 
 "width": 500
}

(Some of that data needs to be properly fleshed out.)

If you want to use your images in Gramps but an image is improperly rotated, you’d have to edit the image to make it display correctly. But using the Image API it could be rotated (even just a fraction of a degree) to display properly. gPrime combined with the Image API gives a complete interface to displaying your images just how you would like. One of features I’d like to incorporate is the functionality of Gramps Photo Tagging gramplet:

This could work in two ways:

  1. Find regions of the image that contains faces
  2. Identify those regions as particular people previously identified in your images

Along those same lines, one could implement a OCR process too. (I work in Machine Learning, and Deep Learning as part of my day job, so I am interested in this.)

The Image API is also designed so that your image collection can be manipulated by third-party applications (using their Presentation API). However, for the gPrime media server to work with that, I think software would need to be created to provide “catalogs”. Not hard, but not high on the goal list either.

The IIIF Consortium is an active group, and are constantly developing new ideas. You can find out more about them here: http://iiif.io/ 

I’d like to thank Ben Brumfield that I met via RootsDev for helping me understand the IIIF Image API. Here is a nice writeup Ben did for RootsDev regarding a hackathon we participated in back in 2015:

https://groups.google.com/d/msg/rootsdev/JWPdCz4An-o/Hi9NfiX-AAAJ

1 thought on “gPrime is an Image Server

Leave a comment