DigitalCollections: IIIF Image API Library (Backend IMPL)

Java library implementing the IIIF Image API 2.0.0 (see http://iiif.io/api/image/2.0/)

License

License

GroupId

GroupId

de.digitalcollections
ArtifactId

ArtifactId

iiif-image-backend-impl
Last Version

Last Version

2.2.6
Release Date

Release Date

Type

Type

jar
Description

Description

DigitalCollections: IIIF Image API Library (Backend IMPL)
Java library implementing the IIIF Image API 2.0.0 (see http://iiif.io/api/image/2.0/)

Download iiif-image-backend-impl

How to add to project

<!-- https://jarcasting.com/artifacts/de.digitalcollections/iiif-image-backend-impl/ -->
<dependency>
    <groupId>de.digitalcollections</groupId>
    <artifactId>iiif-image-backend-impl</artifactId>
    <version>2.2.6</version>
</dependency>
// https://jarcasting.com/artifacts/de.digitalcollections/iiif-image-backend-impl/
implementation 'de.digitalcollections:iiif-image-backend-impl:2.2.6'
// https://jarcasting.com/artifacts/de.digitalcollections/iiif-image-backend-impl/
implementation ("de.digitalcollections:iiif-image-backend-impl:2.2.6")
'de.digitalcollections:iiif-image-backend-impl:jar:2.2.6'
<dependency org="de.digitalcollections" name="iiif-image-backend-impl" rev="2.2.6">
  <artifact name="iiif-image-backend-impl" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.digitalcollections', module='iiif-image-backend-impl', version='2.2.6')
)
libraryDependencies += "de.digitalcollections" % "iiif-image-backend-impl" % "2.2.6"
[de.digitalcollections/iiif-image-backend-impl "2.2.6"]

Dependencies

compile (16)

Group / Artifact Type Version
com.google.guava : guava jar 18.0
com.twelvemonkeys.imageio : imageio-jpeg jar 3.2.1
com.twelvemonkeys.imageio : imageio-tiff jar 3.2.1
commons-io : commons-io jar 2.5
de.digitalcollections : digitalcollections-core-model-api jar 1.2.5
de.digitalcollections : digitalcollections-core-business-api jar 1.2.5
de.digitalcollections : iiif-image-backend-api jar 2.2.6
de.digitalcollections : iiif-image-model-impl jar 2.2.6
javax.cache : cache-api jar 1.0.0
org.apache.httpcomponents : fluent-hc jar 4.5.3
org.ehcache : ehcache jar 3.1.3
org.imgscalr : imgscalr-lib jar 4.2
org.slf4j : slf4j-api jar 1.7.22
org.springframework : spring-context jar 4.3.6.RELEASE
org.springframework : spring-context-support jar 4.3.6.RELEASE
org.springframework : spring-core jar 4.3.6.RELEASE

runtime (2)

Group / Artifact Type Version
de.digitalcollections : digitalcollections-core-backend-impl-file jar 1.2.5
de.digitalcollections : digitalcollections-core-business-impl jar 1.2.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.5.2

Project Modules

There are no modules declared in this project.

⚠️ NOTE: This has been deprecated by https://github.com/dbmdz/iiif-apis ⚠️

IIIF Image API Java Libraries

Build Status MIT License GitHub release Codacy Badge codecov Maven Central

These Java libraries implement the IIIF Image API (see http://iiif.io/api/image/2.0/):

"The IIIF 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."

Features

Usage

Maven dependencies

Depending on what library you want use, these are the dependency definitions for all modules:

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-backend-api</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-backend-impl</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-business-api</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-business-impl</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-model-api</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-model-impl</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-frontend-impl-springmvc</artifactId>
  <version>${version.iiif-image}</version>
</dependency>

Configuration

File resolving of backend

The default implementation (see https://github.com/dbmdz/digitalcollections-core/tree/master/dc-core-backend/dc-core-backend-file) for the backend repository is file based and can be configured by using regular expressions.

Embed IIIF-Controller into your Spring MVC webapplication

  • For IIIF Image API support add Spring MVC-library as dependency to your pom.xml:
<dependency>
  <groupId>de.digitalcollections</groupId>
  <artifactId>iiif-image-frontend-impl-springmvc</artifactId>
  <version>2.1.2</version>
</dependency>
  • Import library's root configuration class into the Spring configuration of your webapp. Example:
@Configuration
@ComponentScan(basePackages = {
  "de.digitalcollections.iiif.image.config"
}) // scans all frontend, business and backend configs of Image API
...
public class SpringConfig implements EnvironmentAware {
  ...
}
  • Add Listener "IIOProviderContextListener" (for supporting additional ImageIO image formats) in your WebappInitializer
import com.twelvemonkeys.servlet.image.IIOProviderContextListener;
...

public class WebappInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  ...
  @Override
  public void onStartup(ServletContext servletContext) throws ServletException {
    super.onStartup(servletContext);
    servletContext.addListener(new IIOProviderContextListener());
  }
}
  • Implement project specific Resolvers for accessing images. Place them into package "de.digitalcollections.core.backend.impl.file.repository.resource.resolver" or a subpackage and implement interface "de.digitalcollections.core.backend.impl.file.repository.resource.resolver.FileNameResolver". They will be found automatically by ComponentScan.

  • Start your Spring MVC webapp. You should see mappings for IIIF-Image-API-URLs in your log:

...
[2016-07-13 15:41:29,868 INFO ] [...] RequestMappingHandlerMapping (main    ) > Mapped "{[/image/v2/{identifier}/info.json],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> de.digitalcollections.iiif.image.frontend.impl.springmvc.controller.v2.IIIFImageApiController.getInfo(java.lang.String,javax.servlet.http.HttpServletRequest) throws de.digitalcollections.iiif.image.frontend.impl.springmvc.exception.ResolvingException,de.digitalcollections.iiif.image.frontend.impl.springmvc.exception.UnsupportedFormatException,java.lang.UnsupportedOperationException,java.io.IOException
[2016-07-13 15:41:29,868 INFO ] [...] RequestMappingHandlerMapping (main    ) > Mapped "{[/image/v2/{identifier}],methods=[GET]}" onto public java.lang.String de.digitalcollections.iiif.image.frontend.impl.springmvc.controller.v2.IIIFImageApiController.getInfoRedirect(java.lang.String)
[2016-07-13 15:41:29,868 INFO ] [...] RequestMappingHandlerMapping (main    ) > Mapped "{[/image/v2/{identifier}/{region}/{size}/{rotation}/{quality}.{format}]}" onto public org.springframework.http.ResponseEntity<byte[]> de.digitalcollections.iiif.image.frontend.impl.springmvc.controller.v2.IIIFImageApiController.getImageRepresentation(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest) throws de.digitalcollections.iiif.image.frontend.impl.springmvc.exception.ResolvingException,de.digitalcollections.iiif.image.frontend.impl.springmvc.exception.UnsupportedFormatException,java.lang.UnsupportedOperationException,java.io.IOException,java.net.URISyntaxException,de.digitalcollections.iiif.image.frontend.impl.springmvc.exception.InvalidParametersException
...

Local build

Clone project and build it:

$ mvn clean install

Using the TurboJPEG backend

By default, a Java-based image processing backend is used. If you want better performance, it is recommended to use the native image processing backend that is based on TurboJPEG. For this, you will have to install a shared library into /usr/lib that the Java code can then load.

If you are running Debian Jessie, you can use the Debian packages provided on the Releases page.

For other distributions, you can use the install_turbojpeg_jni.sh script in the repository root. Note that you will need a recent (>=1.8) JDK, a C compiler and libtool and nasm installed. Just run the script as root on the target machine that runs the application and your image requests should be significantly faster.

de.digitalcollections

Open Source at the Bayerische Staatsbibliothek

...from the MDZ Digital Library team at the Bavarian State Library

Versions

Version
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.0
2.0.1
2.0.0