To demonstrate the capabilities of the ITransformPlugin interface, djatoka provides two reference watermarking plugin implementations; TextWatermark & ImageWatermark. These implementations are intended to allow internal applications to extract images without watermarks and to apply watermarks to images requested by untrusted or undefined domains. TextWatermark overlays a visible copyright statement in the lower left corner of the image generated by djatoka. The ImageWatermark extends TextWatermark by adding an icon overlay image in the lower right corner of the image generated by djatoka.
To set-up the watermarking plugin:
- Stop Tomcat using the djatoka tomcat.sh file located in adore-djatoka-X.X/bin/
- ./tomcat.sh stop
- OpenURLJP2KService.transformPlugin must be uncommented and a watermark implementation defined.
- Text: gov.lanl.adore.djatoka.plugin.TextWatermark
- Image: gov.lanl.adore.djatoka.plugin.ImageWatermark
- Define Watermark.statement, (i.e. label you wish to appear in lower left corner)
- Define Watermark.allowedDomain to define the domain which can bypass watermarking. You'll want to by-pass the watermarking for internal applications which utilize a tile-base image viewing approach.
- To initially test, set this value to localhost, after change it to your domain.
- Define ImageWatermark.imagePath, if using the image watermark, (i.e. absolute path to image logo)
- Start Tomcat using the djatoka tomcat.sh file located in adore-djatoka-X.X/bin/
- ./tomcat.sh start
- Open Demo Image using localhost as the referrer. The watermark will not appear in this case.
- Determine your external address (e.g. uname -n) and replace localhost in the previous request with this host address. When you load the image from this public address, the watermark should appear in the lower corners. You can adjust the opacity and color of the text/images to improved the visibility of the text and/or logo.
- Watermark.statement - Watermark Copyright Statement Property
- Watermark.allowedDomain - Watermark Allowed Domain Property
- Default: An empty string, which does not apply the watermark at all.
- If defined, only images requested outside the defined domain will have the watermark applied.
- Watermark.fontName - Watermark Copyright Font Name Property
- Default: Arial
- Watermark.fontSize - Watermark Copyright Font Size Property
- Default: 12
- Watermark.fontColor - Watermark Copyright Font Color Property
- Default: 255,255,255,255 (i.e. white)
- Watermark.fontOpacity - Watermark Copyright Font Opacity Property
- Default: 0.5f
- ImageWatermark.imagePath - Overlay Image Filepath Property
- ImageWatermark.imageOpacity - Overlaid Image Opacity Property
- Default: 0.25f