IIIF
February 15, 2021 ยท View on GitHub
A sample and quite dumb web server to serve pictures following the iiif API.
Image API Compliance Level 2 is reached.
Setup
libvips is required by bimg.
$ make deps
$ make
$ bin/iiif config.toml
$ DEBUG=iiif,bimg go test -v github.com/greut/iiif/iiif
IIIF image API 2.1
The API specifications can be found on iiif.io.
Identifier
filepath: the path of the fileurl: the URL of the file (double//is replaced with a simple/)base64(url): the URL of the file (encoded using base64)
Region
full: the full imagesquare: a square area in the picture (centered)x,y,w,h: extract the specified region (as pixels)pct:x,y,w,h: extract the specified region (as percentages)smart: attempt to select the center of interest (subject to change as it is not part of IIIF)
Size
full: the full image (deprecated)max: the full imagew,h: a potentially deformed image ofw x h!w,h: a non-deformed image of maximumw x hw,: a non-deformed image withwas the width,h: a non-deformed image withhas the heightpct:n: a non-deformed image scaled bynpercent
Rotate
na clockwise rotation ofndegrees!na flip is done before the rotation
limitations bimg only supports rotations that are multiples of 90.
Quality
colorimage in full colourgrayimage in grayscalebitonalimage in either black or white pixels (not supported)defaultimage returned in the server default quality
Format
jpgpngwebptiff
limitations : bimg (libvips) doesn't support writing to gif, jp2 or pdf.
Profile
It provides all informations but the available sizes and tiles. The sizes information would be much better linked with a Cache system.
Level2 profile
It provides meta-informations about the service. (incomplete)
Viewers
Some viewers are supporting the iiif API out of the box. The following are included.
Features
Download
By adding ?dl to any image, it will trigger the Content-Disposition with attachement and download the file (ref). Otherwise, the Save as command will take a non-default.png filename.
HTTP
Cache-Controlby default 1 year (the maximum value for HTTP/1.1).ETagbased on the full identifier (server independent).Last-Modifiedheaders based on the filesystem information or current time.
TODO
- Adapt
regionformaxwhenmaxWidth,maxHeightand/ormaxAreaare specified.
Friendly projects
Protobuf
$ go get -u github.com/golang/protobuf/protoc-gen-go
$ PATH=$PATH:`pwd`/bin protoc --go_out=. iiif/image.proto