smon

smon

iiif_image_plug - An Elixir Plug implementing the IIIF image API specification.

The International Image Interoperability Framework describes itself:

IIIF is a set of open standards for delivering high-quality, attributed digital objects online at scale. It’s also an international community developing and implementing the IIIF APIs. IIIF is backed by a consortium of leading cultural institutions.

This plug implements the most basic of these standards: The image API (version 3). The official IIIF documentation does a good job of describing the API in detail, so here just a small example.

The basic API syntax is

{scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}

An example based on the plug’s sample image in development would be:

http://127.0.0.1:4000/bentheim.tif/full/max/0/default.jpg

Which would give me a jpg (see the format) version of the original tif:

Now I can change the region, size, rotation, quality and format parameters in my query. The following query will:

  • select a part of the image
    – left: 700 pixel
    – top: 500 pixel
    – width: 520 pixel
    – height: 520 pixel
  • scale the image to 89% of its original size
  • flip the image (!) and then rotate it by 53°
  • make the image bitonal
  • return the image as png
http://127.0.0.1:4000/bentheim.tif/700,500,520,520/pct:89/!53/bitonal.png

The result:

There exist several generic Javascript IIIF viewers that utilize this API to allow for optimized viewing (dynamic loading of parts of the image data based on zoom level/viewport).

WebGIS Javascript libraries like leaflet or OpenLayers support IIIF in one way or the other.

The image processing is handled by libvips via Vix.

See iiif_image_plug | Hex

Most Liked

smon

smon

As hinted in the last update, I rewrote the library utilizing the __using__ makro, which feels way better from a usability standpoint: Overview — IIIFImagePlug v0.6.0

Please poke at it and see if anything breaks or is missing. :wink:

smon

smon

The library is now at version 0.5.0, there is one major question I am still unsure about. Maybe somebody here has some insight:

I have currently defined callback functions as plug parameters to allow the library users’ to inject some of their logic. The primary example would be the identifier_to_path_callback, which allows the plug to construct a filesystem path for a given identifier.

Is this the best way to do it? It seems to me that callbacks are a black box for language servers, you will not get any feedback if your provided callback does implement arity, parameters or return values expected by the plug.

Is meta programming the way to go? The counter argument would be: The callbacks are currently quite simple, so meta programming could introduce quite some complexity on the plug’s code side that is not worth the trade off.

I am currently experimenting with the library while rewriting publication platform for archaeological excavations. This is still in an alpha, besides the IIIF stuff I am also experimenting with LiveView Hooks for OpenLayers, and other stuff - so this link might not work from time to time: https://publication.field.test.idai.world/projects/bourgou/2024-05-14/de/86787076-5253-4071-b1ad-b2644506974d

The platform itself is open source: GitHub

Where Next?

Popular in Libraries Top

marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
Crowdhailer
The latest release of Ace (0.10.0) includes serving content over HTTP/2. I have started writing a webserver to teach my self more about...
New
New
aditya7iyengar
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections. Fo...
New
mbuhot
EctoJob A transactional job queue built with Ecto, PostgreSQL and GenStage Available on Hex.pm: ecto_job | Hex Docs: API Reference — ec...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: https://github.com/tmbb/phoenix_ws Phoenix channels are a great...
New
Antrater
Hi everyone! I’m thrilled to announce a huge thing. We have been developing Elixir Moon Design System for quite a while. We are finally ...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_or...
New
anshuman23
Hello all, I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

Sub Categories:

We're in Beta

About us Mission Statement