iiif

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2017 License: BSD-3-Clause Imports: 22 Imported by: 0

README

IIIF

Build Status Go Report Card Coverage Status

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.

$ go get -u \
         github.com/golang/protobuf/proto \
         github.com/golang/groupcache \
         github.com/golang/lint/golint \
         github.com/gorilla/mux \
         github.com/tj/go-debug \
         gopkg.in/h2non/bimg.v1
$ go build -o bin/iiif
$ bin/iiif --help

$ bin/iiif --host 0.0.0.0 --port 8080 --root images

$ DEBUG=iiif,bimg go test -v

IIIF image API 2.1

The API specifications can be found on iiif.io.

Identifier
  • filepath: the path of the file
  • url: 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 image
  • square: 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 image
  • w,h: a potentially deformed image of w x h
  • !w,h: a non-deformed image of maximum w x h
  • w,: a non-deformed image with w as the width
  • ,h: a non-deformed image with h as the height
  • pct:n: a non-deformed image scaled by n percent
Rotate
  • n a clockwise rotation of n degrees
  • !n a flip is done before the rotation

limitations bimg only supports rotations that are multiples of 90.

Quality
  • color image in full colour
  • gray image in grayscale
  • bitonal image in either black or white pixels (not supported)
  • default image returned in the server default quality
Format
  • jpg
  • png
  • webp
  • tiff

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.

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.

TODO

  • Propose maxWidth, maxHeight and maxArea to prevent DOS on the server.
  • Sendfile

Friendly projects

Protobuf

$ PATH=$PATH:`pwd`/bin protoc --go_out=. image.proto

Documentation

Overview

Package main is a generated protocol buffer package.

It is generated from these files:

image.proto

It has these top-level messages:

ImageWithModTime

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL